Logout = {};
Logout.do_logout = {
    url: undefined,
    post_params: undefined,
    click: function (C, B) {
        this.url = C;
        this.post_params = B;
        if (typeof ChatUIController !== "undefined" && ChatUIController.is_logged_in()) {
            try {
                ChatUIController.logout(true)
            } catch (A) {
                if (DEBUG === true) {
                    alert(A.toString())
                }
            }
        }
        StateManager.stop();
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function () {
        document.location.href = LOGIN_URL;
        document.location.reload()
    }, after: function () {}, open: function () {}, close: function () {}
};
load.trace("js/web2-Zero/actions/1_logout.js");
load.trace("js/web2-Zero/actions/1_videos_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    CanvasTrigger.extend({
        videos_canvas: function () {
            UI.tab("tab_media");
            if ($("video_search_term")) {
                Hint.register("video_search_term", $("video_search_term_text").value)
            }
        }
    });
    VideosTrigger.extend({
        video_search_bar: function () {
            if ($("video_search_term")) {
                Hint.register("video_search_term", $("video_search_term_text").value)
            }
        }, videos_menu_placeholder: function () {
            if ($("video_search_term")) {
                Hint.register("video_search_term", $("video_search_term_text").value)
            }
        }
    });
    LightBoxTrigger.extend({
        add_videos_to_playlist: function () {
            Videos.AddToPlaylist.VideoInput.init_multiplier("video_urls", "onfocus", [])
        }
    })
});
var Home = {};
Home.send_invitation = {
    url: undefined,
    post_params: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        if (!Hint.is_dirty("send_invitation_input")) {
            $("send_invitation_input").value = ""
        }
        Request.AJAX.submit_form(this.url, this, $id("send_invitation_form"))
    }, before: function (A) {}, after: function (A) {}, open: function () {}, close: function () {}
};
Home.view_wall = {
    url: undefined,
    post_params: undefined,
    click: function (B, A) {
        this.url = B;
        this.post_params = A;
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {}, after: function (B) {
        var C = $("wall").getElements("div");
        for (var A = 0; A < C.length; A++) {
            if (C[A].id.match("wall_post_")) {
                C[A].scrollIntoView();
                break
            }
        }
    }, open: function () {}, close: function () {}
};
Home.view_places = {
    url: undefined,
    post_params: undefined,
    click: function (B, A) {
        this.url = B;
        this.post_params = A;
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {}, after: function (B) {
        var A = $("local_places");
        A.scrollIntoView()
    }, open: function () {}, close: function () {}
};
Home.invitation_tracking = {
    url: undefined,
    get_params: new Array(),
    focus_event: new Array(),
    onfocus: function (A, C, B) {
        this.url = A;
        this.get_params.push(B)
    }, click: function (A, C, B) {
        this.url = A;
        this.send()
    }, send: function () {
        if (typeof this.url !== "undefined" && typeof this.get_params !== "undefined" && typeof this.get_params.length !== "undefined" && this.get_params.length > 0) {
            Request.AJAX.send(this.url, this, false);
            this.get_params = []
        }
    }, before: function (A) {}, after: function (A) {}, open: function () {}, close: function () {}, focus_capture: function () {
        var A = new Date();
        Home.invitation_tracking.focus_event.push({
            "time": A.getTime(),
            "invitations": $("send_invitation_counter").value
        })
    }
};
Home.comment_status_factory = {
    click_with_template: function (A, B, G, D, L) {
        var C = {
            translations: undefined,
            EMPTY_ERROR_CODE: 1,
            text_area_id: undefined,
            init: function (N, M) {
                this.text_area_id = N;
                this.translations = M
            }, validate: function () {
                if (Validator.is_empty($(this.text_area_id))) {
                    this.on_failure_action(this.EMPTY_ERROR_CODE);
                    return false
                }
                return true
            }, on_failure_action: function (M) {
                switch (M) {
                case this.EMPTY_ERROR_CODE:
                    Validator.feedback.inline(this.text_area_id, this.translations.empty_body_error);
                    break;
                default:
                    if (DEBUG) {
                        throw "Unhandled error"
                    }
                }
            }
        };
        var E = {
            url: undefined,
            post_params: undefined,
            validator: C,
            post_id: undefined,
            textarea: undefined,
            max_length: MAX_WALL_COMMENT_LENGTH,
            feedback_submit_button: undefined,
            click: function (N, M, O) {
                this.post_params = M;
                this.url = N;
                this.post_id = this.post_params.wall_post_id;
                this.validator.init("reply_wall_post_wall_post_body_" + this.post_id, O);
                this.open()
            }, send: function () {
                var M = $("reply_wall_post_form_" + this.post_params.wall_post_id);
                Request.AJAX.submit_form(this.url, this, M)
            }, after: function (M) {
                FeedbackController.createFeedbackFromRequestData(M);
                if (M.getAttribute("success")) {
                    $("trigger-wall_post_replies_" + this.post_params.wall_post_id).show();
                    if ($("wall_post_reply_footer_" + this.post_params.wall_post_id).getChildren().length > 0) {
                        $("wall_post_reply_footer_" + this.post_params.wall_post_id).show()
                    }
                    $("wall_post_replies_container_" + this.post_params.wall_post_id).show();
                    if ($("load_initial_comments_" + this.post_params.wall_post_id)) {
                        $("load_initial_comments_" + this.post_params.wall_post_id).hide()
                    }
                    if ($("wall_post_newsItem_" + this.post_params.wall_post_id)) {
                        $("wall_post_newsItem_" + this.post_params.wall_post_id).addClass("homeItems")
                    }
                }
                this.reset();
                this.close()
            }, reset: function () {
                $("reply_wall_post_wall_post_body_" + this.post_params.wall_post_id).innerHTML = ""
            }, open: function () {
                $("reply_wall_post_wrapper_" + this.post_params.wall_post_id).show();
                $("reply_wall_post_form_" + this.post_params.wall_post_id).show();
                $("wall_reply_button_" + this.post_params.wall_post_id).hide();
                this.add_listeners();
                this.feedback_submit_button = FormFeedback.submit_button(L.button, L.process_message, L.success_message, L.failure_message)
            }, close: function () {
                $("reply_wall_post_wrapper_" + this.post_params.wall_post_id).hide();
                $("reply_wall_post_form_" + this.post_params.wall_post_id).hide();
                $("wall_reply_button_" + this.post_params.wall_post_id).show()
            }, add_listeners: function () {
                this.textarea = $("reply_wall_post_wall_post_body_" + this.post_params.wall_post_id);
                var M = this;
                if (this.textarea) {
                    this.textarea.onkeydown = function (N) {
                        return M.keydown(N)
                    };
                    this.textarea.onkeyup = function (N) {
                        return M.keyup(N)
                    }
                }
            }, keydown: function (N) {
                N = N || window.event;
                var M = true;
                var O = N.charCode || N.keyCode;
                if (O === 8 || O === 46) {} else {
                    if (KeyCode.is_holding_meta_key(N)) {} else {
                        if (O === 13 || KeyCode.is_text_character(O)) {
                            M = this.textarea.value.length < this.max_length
                        } else {
                            TConsole.log(O)
                        }
                    }
                }
                return M
            }, keyup: function () {
                var M = this.textarea.value.length < this.max_length;
                if (!M) {
                    this.textarea.value = this.textarea.value.substr(0, this.max_length)
                }
            }
        };
        var K = {
            "close_button": function () {
                E.close();
                return false
            }, "submit_button": function () {
                E.send();
                return false
            }
        };
        JSTemplates.load_template("js_template_wall_post_form", G, L.reply_wall_post_prefix, B.wall_post_id, D, K);
        var J = $(L.reply_wall_post_prefix + "_media_bar_" + B.wall_post_id);
        var I = $(L.reply_wall_post_prefix + "_wall_post_body_" + B.wall_post_id);
        if (typeof L.isStatusWallPost !== "undefined") {
            var H = L.isStatusWallPost
        } else {
            var H = false
        }
        var F = new MediaBarController(I, null, null, L.reply_wall_post_prefix, B.wall_post_id, H);
        F.injectDefaultMediaBar(J);
        E.click(A, B, D)
    }
};
Home.load_inital_comment_status_factory = {
    click: function (C, B, D) {
        var A = {
            url: undefined,
            post_params: undefined,
            post_id: undefined,
            click: function (F, E, G) {
                this.post_params = E;
                this.url = F;
                this.post_id = G.post_id;
                this.send()
            }, send: function () {
                Request.AJAX.send(this.url, this)
            }, after: function (E) {
                $("trigger-wall_post_replies_" + this.post_id).show();
                if ($("wall_post_reply_footer_" + this.post_id).getChildren().length > 0) {
                    $("wall_post_reply_footer_" + this.post_id).show()
                }
                $("wall_post_replies_container_" + this.post_id).show();
                $("load_initial_comments_" + this.post_id).hide()
            }
        };
        A.click(C, B, D)
    }
};
Home.comment_on = {
    _collapsed_nodes: {}, _config: {}, textPair: function (B, A) {
        this.orig = B;
        this.crop = A;
        this.showCrop = function () {
            A.show();
            B.hide()
        }, this.showOrig = function () {
            B.show();
            A.hide()
        }, this.toggle = function () {
            if (B.isHidden()) {
                this.showOrig()
            } else {
                this.showCrop()
            }
        }
    }, find_and_crop_comments: function () {
        var K = this._config["wall_comment_id"] || "wall_post_reply_comment_";
        var D = this._config["wall_comment_container_id"] || "wall_post_replies_container_";
        var M = this._config["number_of_lines"] || 3;
        var J = this._config["line_height"] || 18;
        var I = this._config["ellipsis_text"] || "More";
        var S = this._config["ellipsis_class"] || "viewMore";
        var F = document.getElementsByPartialId(D, false);
        var R = F.length;
        if (R) {
            for (var Q = 0; Q < R; Q++) {
                var O = $(F[Q]);
                var U = O.id;
                var H = O.id.match(D + "(.*)$");
                if (H) {
                    U = H[1]
                }
                var G = O.getElementsByPartialId(K, false);
                var T = G.length;
                if (T) {
                    for (var P = 0; P < T; P++) {
                        var C = $(G[P]);
                        var B = C.getElementsByPartialId("wall_post_reply_text_", false);
                        if (B && typeof B[0] !== "undefined") {
                            var L = $(B[0]);
                            var E = $(L.cloneNode(true));
                            E.hide();
                            E.id += "_uncropped";
                            $(E).inject(L.parentNode, "top");
                            var A = new Home.comment_on.textPair(E, L);
                            var N = document.createElement("a");
                            N.setAttribute("href", "#");
                            N.className = S;
                            N.appendChild(document.createTextNode(I));
                            N.onclick = function (V) {
                                return function () {
                                    V.toggle();
                                    return false
                                }
                            }(A);
                            L.cropText(M, J, N);
                            if (typeof this._collapsed_nodes[U] === "undefined") {
                                this._collapsed_nodes[U] = []
                            }
                            this._collapsed_nodes[U].push(A)
                        }
                    }
                }
            }
        }
    }, collapse_comments: function (A) {
        if (typeof A !== "undefined") {
            this._config = A
        }
        this.find_and_crop_comments()
    }, uncollapse_comments: function (C) {
        var A = (typeof this._collapsed_nodes[C] !== "undefined") ? this._collapsed_nodes[C] : [];
        for (var B = 0; B < A.length; B++) {
            A[B].showOrig()
        }
    }, uncollapse_comments_handler: {
        url: undefined,
        post_params: undefined,
        additional_params: undefined,
        click: function (B, A, C) {
            this.url = B;
            this.post_params = A;
            this.additional_params = C;
            this.send()
        }, send: function () {
            Request.AJAX.send(this.url, this)
        }, before: function () {
            Home.comment_on.uncollapse_comments(this.additional_params.id)
        }
    }
};
load.trace("js/web2-Zero/actions/1_home.js");
var set_width_friends_updates = function () {
    var A = function (C) {
        var E = C.getParent().offsetWidth;
        var B = C.getPrevious().offsetWidth;
        var D = E - B;
        C.setStyle("width", (D - 4) + "px")
    };
    $each($("friends_updates").getElements("ul"), A);
    $each($("friends_updates").getElements("p"), A)
};
var add_tracking_event_callback = function () {
    window.addEvent("beforeunload", Home.invitation_tracking.send)
};
loader.add_load_finished_selector(1, function () {
    if ($id("home")) {
        set_width_friends_updates()
    }
});
load.trace("js/web2-Zero/actions/1_home_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    CanvasTrigger.extend({
        home_feed_button_switch_timeout: undefined,
        home: function () {
            if ($("new_password")) {
                $("new_password").addEvent("keyup", function () {
                    Newuserexperience.change_password.doChecks($("new_password").value)
                })
            }
            if ($("old_password")) {
                $("old_password").addEvent("keyup", function () {
                    Newuserexperience.change_password.resetOldPasswordField()
                })
            }
            if ($("passwordBannerPasswordCopy")) {
                $("passwordBannerPasswordCopy").addEvent("keyup", function () {
                    Newuserexperience.change_password.checkIfEqual()
                })
            }
            if ($("passwordStrengthTipBoxNUE")) {
                $("passwordStrengthTipBoxNUE").addEvent("click", function () {
                    $("passwordTips").toggle();
                    return false
                }, true)
            }
            if ($id("notification_page_admin_promotions")) {
                $("notification_page_admin_promotions").addEvent("click", function () {
                    Group.lightNotifications.click({
                        overlay_target: "notification_page_admin_promotions"
                    })
                })
            }
            if ($("send_invitation_input")) {
                UI.tab("tab_home");
                Hint.register("send_invitation_input", $("send_invitation_input_tip").value)
            }
            if ($("chat_home_roster") && typeof ChatUIController !== "undefined") {
                ChatUIBuddyList.check_active_view(true)
            }
            set_width_friends_updates();
            if (VideoPlayer.is_video_ad_ready()) {
                VideoAdWrapper.init()
            }
            add_tracking_event_callback();
            if ($("comment_on_config")) {
                var B = JSON.decode($("comment_on_config").getAttribute("config"));
                Home.comment_on.collapse_comments(B)
            }
            if ($("friend_feed_config")) {
                if (typeof this.home_feed_button_switch_timeout !== "undefined") {
                    clearTimeout(this.home_feed_button_switch_timeout)
                }
                var A = JSON.decode($("friend_feed_config").getAttribute("config"));
                if (typeof A["timestamp_ttl"] !== "undefined") {
                    this.home_feed_button_switch_timeout = setTimeout(function () {
                        if ($("show_more_friend_updates")) {
                            $("show_more_friend_updates").hide();
                            if ($("show_search_page")) {
                                $("show_search_page").show()
                            }
                        }
                    }, A["timestamp_ttl"])
                }
            }
        }
    });
    HomeTrigger.extend({
        invitations: function () {
            if ($("send_invitation_input")) {
                Hint.register("send_invitation_input", $("send_invitation_input_tip").value)
            }
        }, subheader: function () {
            if (UserStatus.is_status_enabled()) {
                UserStatus.init()
            }
            if (typeof ChatUIController !== "undefined" && ChatUIBuddyList) {
                ChatUIBuddyList.check_active_view(true);
                ChatUIBuddyListHeaderView.init()
            }
        }, friends_updates_feed: function (B) {
            UI.actions(B);
            if ($("comment_on_config")) {
                var A = JSON.decode($("comment_on_config").getAttribute("config"));
                Home.comment_on.collapse_comments(A)
            }
        }
    });
    CanvasExitsTrigger.extend({
        home: function () {
            UserStatusZ.comments_notifications.destroy_notification();
            Group.lightNotifications.destroy_notification()
        }
    })
});
var FriendsImporter = {};
FriendsImporter.finishedClose = {
    url: undefined,
    post_params: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.send()
    }, send: function () {
        LightBox.close();
        Request.AJAX.send(this.url, this)
    }, before: function (A) {}, after: function (A) {}, open: function () {}, close: function () {}
};
FriendsImporter.commit = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    email_field_id: undefined,
    password_field_id: undefined,
    empty_credentials_id: undefined,
    invalid_credentials_id: undefined,
    is_init_page: undefined,
    form_post_contacts_list_param_id: undefined,
    feedback_submit_button: undefined,
    get_selected_contacts_from_new_importer: function () {
        if (!isObjectEmpty(FriendsImporterNew.invite_people.people_to_invite)) {
            var B = [];
            for (var A in FriendsImporterNew.invite_people.people_to_invite) {
                if (!FriendsImporterNew.invite_people.people_to_invite.hasOwnProperty(A)) {
                    continue
                }
                B.push(FriendsImporterNew.invite_people.people_to_invite[A])
            }
            this.post_params[FriendsImporter.commit.form_post_contacts_list_param_id] = B.join(",")
        }
    }, click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = C.form_id;
        if (typeof C.is_init_page !== "undefined") {
            this.is_init_page = C.is_init_page
        } else {
            this.is_init_page = false
        }
        if (this.is_init_page) {
            this.email_field_id = C.email_field_id;
            this.password_field_id = C.password_field_id;
            this.empty_credentials_id = C.empty_credentials_id;
            this.invalid_credentials_id = C.invalid_credentials_id
        }
        if (typeof C.form_post_contacts_list_param_id !== "undefined") {
            this.form_post_contacts_list_param_id = C.form_post_contacts_list_param_id;
            FriendsImporter.commit.get_selected_contacts_from_new_importer()
        }
        if (this.is_init_page) {
            if (Validator.is_empty(this.email_field_id) || Validator.is_empty(this.password_field_id)) {
                $(this.empty_credentials_id).removeClass("hide");
                $(this.invalid_credentials_id).addClass("hide");
                return false
            } else {
                $(this.empty_credentials_id).addClass("hide");
                this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
                this.send()
            }
        } else {
            this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
            this.send()
        }
    }, send: function () {
        if (this.form_id) {
            var A = $("loading_message");
            var B = $(this.form_id);
            if (A) {
                A.show();
                B.hide()
            }
            Request.AJAX.submit_form(this.url, this, B, undefined, true)
        } else {
            Request.AJAX.send(this.url, this, undefined, true)
        }
    }, before: function (A) {}, after: function (A) {
        FriendsImporterNew.invite_people.init_trigger()
    }, open: function () {}, close: function () {}
};
load.trace("js/web2-Zero/actions/1_friendsimporter.js");
var Newuserexperience = {};
Newuserexperience.skip_step = {
    url: undefined,
    post_params: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this, true)
    }, before: function (A) {}, after: function (A) {
        if ($("guide_canvas").innerHTML.trim().length == 0) {
            $("guide_canvas").parentNode.removeChild($("guide_canvas"))
        }
    }, open: function () {}, close: function () {}
};
Newuserexperience.high_priority_step = {
    close: function (A, C, E) {
        if (typeof E === "undefined") {
            E = true
        }
        Cookie.create(C, "1", 1);
        var D = $(A);
        D.hide();
        var B = undefined;
        if (E) {
            B = D.nextSibling;
            while (B != null && !(B.tagName && B.tagName.toLowerCase() === "div")) {
                B = B.nextSibling
            }
            if (B != null) {
                $(B).show()
            }
        }
        if (!E || !B) {
            $("high_priority_step_guide_canvas").hide()
        }
    }
};
Newuserexperience.terms_of_service = {
    url: undefined,
    post_params: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        Newuserexperience.high_priority_step.close(C.step_div_id, C.cookie_name, false);
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this, true)
    }, before: function (A) {}, after: function (A) {}, open: function () {}, close: function () {}
};
Newuserexperience.location_autofill = {
    autofill: undefined,
    init: function (A, B, C) {
        this.autofill = new Autofill(A, this, B, C, true)
    }, item_action: function (C, B, A, E, D, G) {
        var F = $(G.location_field_id);
        F.value = E
    }
};
Newuserexperience.change_password = {
    url: undefined,
    post_params: undefined,
    form_id: "nue_change_password",
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.success_feedback_message = C.success_feedback_message;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send();
        $(C.old_password_param).value = "";
        $(C.new_password_param).value = "";
        $(C.new_password_copy_param).value = ""
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $(this.form_id))
    }, before: function (A) {
        var B = JSON.decode(A.innerHTML);
        Validator.feedback.show(B.errors, $(this.form_id), $("change_password_message"));
        if (A.getAttribute("success")) {
            UI.Feedback.message_inline.remove("change_password_form");
            UI.Feedback.message_inline.add("change_password_form", UI.Feedback.injection_mode.before, this.success_feedback_message, UI.Feedback.message_type.user, UI.Feedback.note_type.success)
        } else {
            UI.Feedback.message_inline.add("change_password_form", UI.Feedback.injection_mode.before, B.message, UI.Feedback.message_type.user, UI.Feedback.note_type.error)
        }
    }, after: function (B) {
        this.clearErrors();
        if ($("new_password").getNext()) {
            var A = $("new_password").getNext();
            if (A.hasClass("error validation_message")) {
                A.inject($("password_meter"), "after")
            }
        }
        if (!$("password_error_has_user_name").hasClass("error")) {
            $("password_error_has_user_name").addClass("error");
            $("password_error_has_last_name").addClass("error");
            $("password_error_has_mail").addClass("error");
            $("password_error_empty").addClass("error");
            $("password_error_too_short").addClass("error")
        }
    }, open: function () {}, close: function () {}, doChecks: function (A) {
        this.clearErrors();
        this._results = PasswordChecker.checkPassword.getStrength(A);
        if (this._results.reason !== "undefined") {
            this._displayErrorMessages(this._results.reason)
        }
        PasswordChecker.UI.displayMeter(this._results.level);
        this._resetMeterIfEmpty()
    }, _resetMeterIfEmpty: function () {
        if ($("new_password").value.length === 0) {
            $("password_meter").setClass("meter");
            $("password_meter_text").innerHTML = ""
        }
    }, _displayErrorMessages: function (A) {
        if (A === "firstNameInPwd") {
            if ($("new_password")) {
                $("new_password").addClass("error");
                $("new_password_copy").addClass("error");
                $("password_error_has_user_name").show()
            }
        } else {
            if (A === "lastNameInPwd") {
                if ($("new_password")) {
                    $("new_password").addClass("error");
                    $("new_password_copy").addClass("error");
                    $("password_error_has_last_name").show()
                }
            } else {
                if (A === "emailInPwd") {
                    if ($("new_password")) {
                        $("new_password").addClass("error");
                        $("new_password_copy").addClass("error");
                        $("password_error_has_mail").show()
                    }
                }
            }
        }
    }, _cleanErrorState: function () {
        if ($("new_password").hasClass("error")) {
            $("new_password").removeClass("error")
        }
        if ($("new_password_copy").hasClass("error")) {
            $("new_password_copy").removeClass("error")
        }
    }, resetOldPasswordField: function () {
        if ($("old_password").getNext()) {
            $("old_password").getNext().hide();
            $("old_password").removeClass("error")
        }
    }, clearErrors: function () {
        var A = $("password_meter");
        if (A.getNext()) {
            if (A.getNext().hasClass("error validation_message")) {
                if ($("new_password").value.length > 0) {
                    if (A.getNext()) {
                        A.getNext().hide()
                    }
                    if ($("new_password_copy").getNext()) {
                        $("new_password_copy").getNext().hide()
                    }
                }
            }
        }
        if ($("new_password").value.trim().length < 8) {
            $("new_password").removeClass("error");
            $("new_password_copy").removeClass("error");
            $("password_error_has_user_name").hide();
            $("password_error_has_last_name").hide();
            $("password_error_has_mail").hide()
        }
    }, checkIfEqual: function () {
        if ($("new_password_copy").value.trim().length >= $("new_password").value.trim().length) {
            if ($("new_password_copy").value !== $("new_password").value) {
                $("password_error_not_equal").show()
            } else {
                $("password_error_not_equal").hide()
            }
        } else {
            $("password_error_not_equal").hide()
        }
    }
};
load.trace("js/web2-Zero/actions/1_newuserexperience.js");
var AvatarSelector = {};
AvatarSelector.choosePhoto = {
    click: function (B, C, A) {
        PhotoChooser.open(this, B, null, A.croppingUrl, null, A, true)
    }, photoChooserDidBeginUpload: function () {
        return false
    }, photoChooserDidSelectPhotos: function (C, D, B) {
        var A = B.croppingUrl;
        A += "&" + B.photo_key_param + "=" + encodeURIComponent(D[0]);
        LightBox.click(A, {}, B)
    }, photoChooserDidClose: function () {}
};
AvatarSelector.edit_photo = {
    spill: undefined,
    viewport: undefined,
    position: {
        x: undefined,
        y: undefined
    }, stored_position: {
        x: undefined,
        y: undefined
    }, max_left: undefined,
    max_top: undefined,
    height: undefined,
    width: undefined,
    side: undefined,
    half_side: undefined,
    init_photo: function (C, B) {
        var A = AvatarSelector.edit_photo;
        A.avatar_photo = $(C);
        A.position.x = (B.x) ? B.x : 50;
        A.position.y = (B.y) ? B.y : 50;
        A.height = C.offsetHeight;
        A.width = C.offsetWidth;
        A.side = (A.height < A.width) ? A.height : A.width;
        A.half_side = A.side / 2;
        A.max_left = A.width - A.side;
        A.max_top = A.height - A.side;
        A.spill = $("dimmed_avatar");
        A.viewport = $("avatar_viewport");
        A.spill.style.height = A.height + "px";
        A.spill.style.width = A.width + "px";
        $("avatar_cropper").style.height = A.height + "px";
        $("avatar_cropper").style.width = A.width + "px";
        A.viewport.style.height = A.side + "px";
        A.viewport.style.width = A.side + "px";
        A.place_photo({
            x: 0,
            y: 0
        });
        LightBox.overlayLightbox.show();
        A.viewport.addEvent("mousedown", function (D) {
            AvatarSelector.edit_photo.dragging.mousedown(D);
            return false
        });
        A.spill.addEvent("mousedown", function (D) {
            return false
        })
    }, place_photo: function (D) {
        var A = AvatarSelector.edit_photo;
        var C, B;
        if (A.height < A.width) {
            C = parseInt(A.width * A.position.x / 100 + D.x - A.half_side);
            B = 0;
            C = Math.max(C, 0);
            C = parseInt(Math.min(C, A.max_left), 10)
        } else {
            C = 0;
            B = parseInt(A.height * A.position.y / 100 + D.y - A.half_side);
            B = Math.max(B, 0);
            B = parseInt(Math.min(B, A.max_top), 10)
        }
        A.viewport.style.left = C + "px";
        A.viewport.style.top = B + "px";
        A.viewport.style.backgroundPosition = (-C) + "px " + (-B) + "px";
        AvatarSelector.edit_photo.stored_position.x = C;
        AvatarSelector.edit_photo.stored_position.y = B
    }, dragging: {
        start: {
            x: undefined,
            y: undefined
        }, mousedown: function (B) {
            var A = AvatarSelector.edit_photo.dragging;
            var C = get_mouse_position(B);
            A.start.x = C.x;
            A.start.y = C.y;
            A.add_listeners();
            return false
        }, mousemove: function (C) {
            var A = AvatarSelector.edit_photo.dragging;
            var B = get_mouse_position(C);
            var D = A.substract_coordinates(B, A.start);
            AvatarSelector.edit_photo.place_photo(D);
            return false
        }, mouseup: function (B) {
            var A = AvatarSelector.edit_photo.dragging;
            A.remove_listeners();
            return false
        }, mouseout: function (B) {
            var A = AvatarSelector.edit_photo.dragging;
            A.remove_listeners();
            return false
        }, substract_coordinates: function (B, A) {
            return {
                x: B.x - A.x,
                y: B.y - A.y
            }
        }, add_listeners: function () {
            var A = $(document.body);
            A.addEvent("mousemove", AvatarSelector.edit_photo.dragging.mousemove);
            A.addEvent("mouseup", AvatarSelector.edit_photo.dragging.mouseup);
            A.addEvent("mouseout", AvatarSelector.edit_photo.dragging.mouseout)
        }, remove_listeners: function () {
            var A = $(document.body);
            A.removeEvent("mousemove", AvatarSelector.edit_photo.dragging.mousemove);
            A.removeEvent("mouseup", AvatarSelector.edit_photo.dragging.mouseup);
            A.removeEvent("mouseout", AvatarSelector.edit_photo.dragging.mouseout)
        }
    }
};
AvatarSelector.save_avatar = {
    url: undefined,
    post_params: undefined,
    offset_x_param_name: undefined,
    offset_y_param_name: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.offset_x_param_name = C.offset_x_param_name;
        this.offset_y_param_name = C.offset_y_param_name;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        this.post_params[this.offset_x_param_name] = parseInt((100 * (AvatarSelector.edit_photo.stored_position.x + AvatarSelector.edit_photo.half_side)) / AvatarSelector.edit_photo.width, 10);
        this.post_params[this.offset_y_param_name] = parseInt((100 * (AvatarSelector.edit_photo.stored_position.y + AvatarSelector.edit_photo.half_side)) / AvatarSelector.edit_photo.height, 10);
        Request.AJAX.send(this.url, this)
    }, before: function (A) {
        if (A.getAttribute("success")) {
            LightBox.close()
        } else {
            $("edit_avatar_error").removeClass("hide");
            $("edit_avatar_error").innerHTML = A.innerHTML
        }
    }, after: function (A) {}, open: function () {}, close: function () {}
};
load.trace("js/web2-Zero/actions/1_avatarselector.js");
load.trace("js/web2-Zero/actions/1_avatarselector_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    LightBoxTrigger.extend({
        choose_avatar_photo: function () {
            LightBox.open();
            LightBox.prepare_close();
            LightBox.resize()
        }, edit_avatar: function () {
            LightBox.open();
            LightBox.prepare_close();
            LightBox.resize()
        }
    })
});
var UserStatusZ = {
    url: undefined,
    postParams: undefined,
    bodyParamName: undefined,
    newStatusDomId: undefined,
    reloadWallRequestConfig: undefined,
    statusWallIntegrated: false,
    clearOnBlur: false,
    maxCharacterLength: 140,
    _verticalScrollBarCorrection: 40,
    _verticalPaddingCorrection: 2,
    _verticalPaddingBrowserFix: 2,
    singleLineTextAreaHeight: undefined,
    defaultTipText: undefined,
    blockBlur: false,
    box: undefined,
    textArea: undefined,
    clone: undefined,
    characterCounter: undefined,
    characterCounterNumber: undefined,
    saveButton: undefined,
    onfocus: function (B, C, A) {
        UserStatusZ.init(B, C, A)
    }, init: function (C, D, B) {
        this.statusWallIntegrated = B.status_integration_active;
        if (this.statusWallIntegrated) {
            this.reloadWallRequestConfig = B.reloadWallRequestConfig
        }
        this.maxCharacterLength = B.max_character_length;
        this.url = C;
        this.postParams = D;
        this.bodyParamName = B.body_param_name;
        this.newStatusDomId = B.new_status_dom_id;
        this.box = $("user_status_box");
        this.textArea = $("user_status_textarea");
        this.characterCounter = $("user_status_char_count");
        this.characterCounterNumber = $("user_status_char_count_number");
        this.saveButton = $("user_status_button");
        this.clone = new Element("textarea");
        this.clone.rows = 20;
        this.clone.setStyles({
            "width": parseInt(this.textArea.offsetWidth - this._verticalScrollBarCorrection, 10) + "px",
            "position": "absolute",
            "overflow": "auto",
            "visibility": "hidden",
            "top": 0,
            "left": 0,
            "border": 0,
            "padding": 0,
            "margin": 0,
            "font": "normal 18px Arial,Helvetica,sans-serif"
        });
        this.clone.className = this.textArea.className;
        this.clone.inject(this.textArea, "after");
        this.defaultTipText = this.textArea.value;
        var A = this.clone.scrollHeight - this._verticalPaddingCorrection - this.textArea.offsetHeight;
        this.singleLineTextAreaHeight = this.textArea.offsetHeight + A;
        if (Browser.ie) {
            this._verticalPaddingBrowserFix = A + 24
        } else {
            if (Browser.firefox) {
                this._verticalPaddingBrowserFix = 0
            } else {
                if (Browser.webkit) {
                    this._verticalPaddingBrowserFix = -A - 16
                }
            }
        }
        this.textArea.onfocus = function (E) {
            UserStatusZ.textAreaListeners.focus(E);
            return true
        };
        this.textArea.onblur = function (E) {
            UserStatusZ.textAreaListeners.blur(E);
            return true
        };
        this.textArea.onkeydown = function (E) {
            return UserStatusZ.textAreaListeners.keydown(E)
        };
        this.textArea.onkeyup = function (E) {
            return UserStatusZ.textAreaListeners.keyup(E)
        };
        this.textArea.onkeypress = function (E) {
            return UserStatusZ.textAreaListeners.keypress(E)
        };
        this.saveButton.onmousedown = function (E) {
            UserStatusZ.saveButtonListeners.mousedown(E);
            return true
        };
        this.saveButton.onclick = function (E) {
            UserStatusZ.saveButtonListeners.click(E);
            return false
        };
        this.prepareTextAreaForEdit()
    }, textAreaListeners: {
        focus: function (A) {
            UserStatusZ.prepareTextAreaForEdit();
            UserStatusZ.resizeTextAreaToFit()
        }, blur: function (A) {
            if (!UserStatusZ.blockBlur && (UserStatusZ.clearOnBlur || UserStatusZ.isStatusTextDefault() || UserStatusZ.isStatusTextEmpty())) {
                UserStatusZ.resetTextArea()
            }
        }, keydown: function (B) {
            B = B || window.event;
            var A = true;
            var C = B.charCode || B.keyCode;
            if (C === 13) {
                UserStatusZ.commitEditing();
                if (Browser.ie8) {
                    B.cancelBubble = true;
                    if (B.stopPropagation) {
                        B.stopPropagation()
                    }
                }
                A = false
            } else {
                if (C === 27) {
                    UserStatusZ.resetTextArea();
                    UserStatusZ.textArea.blur();
                    A = false
                } else {
                    if (C === 8 || C === 46) {} else {
                        if (KeyCode.is_holding_meta_key(B)) {} else {
                            if (KeyCode.is_text_character(C)) {
                                if (!UI.textarea.has_selected_text(UserStatusZ.textArea)) {
                                    A = UserStatusZ.canWriteAnotherCharacter()
                                }
                            } else {
                                TConsole.log(C)
                            }
                        }
                    }
                }
            }
            return A
        }, keyup: function () {
            UserStatusZ.cropStatusIfNeeded();
            UserStatusZ.updateCharacterCount();
            UserStatusZ.resizeTextAreaToFit()
        }, keypress: function (A) {
            UserStatusZ.cropStatusIfNeeded();
            UserStatusZ.updateCharacterCount();
            UserStatusZ.resizeTextAreaToFit()
        }
    }, saveButtonListeners: {
        mousedown: function (A) {
            UserStatusZ.blockBlur = true
        }, click: function (A) {
            UserStatusZ.commitEditing();
            UserStatusZ.blockBlur = false
        }
    }, prepareTextAreaForEdit: function () {
        if (this.isStatusTextDefault()) {
            this.textArea.value = ""
        }
        this.textArea.disabled = false;
        this.box.addClass("active");
        this.textArea.removeClass("saving");
        this.updateCharacterCount();
        this.characterCounter.show();
        this.saveButton.disabled = false;
        this.saveButton.removeClass("disabled");
        $("user_status_char_count").show()
    }, resetTextArea: function () {
        this.textArea.disabled = false;
        this.box.removeClass("active");
        this.textArea.removeClass("saving");
        this.characterCounter.show();
        this.saveButton.disabled = "disabled";
        this.saveButton.addClass("disabled");
        $("user_status_button_label_normal").show();
        $("user_status_button_label_saving").hide();
        $("user_status_char_count").hide();
        this.textArea.value = this.defaultTipText;
        this.resizeTextAreaToFit()
    }, commitEditing: function () {
        this.commitStatusHandler.perform(this.url, this.postParams, this.bodyParamName, this.getCleanStatusText());
        this.textArea.blur();
        this.textArea.disabled = "disabled";
        this.box.removeClass("active");
        this.textArea.addClass("saving");
        this.saveButton.disabled = "disabled";
        this.saveButton.addClass("disabled");
        $("user_status_button_label_normal").hide();
        $("user_status_button_label_saving").show();
        this.saveButton.blur()
    }, resizeTextAreaToFit: function () {
        var B = UserStatusZ.textArea.value;
        if (!Browser.firefox) {
            B.replace(/\n$/, "")
        }
        this.clone.value = B;
        if (Browser.ie) {
            this.clone.scrollTop = 10000
        }
        var A = parseFloat(this.clone.scrollHeight) / this.singleLineTextAreaHeight;
        var C = Math.round(A) * this.singleLineTextAreaHeight + this._verticalPaddingBrowserFix;
        if (this.textArea.style.height !== C + "px") {
            this.textArea.style.height = C + "px"
        }
    }, canWriteAnotherCharacter: function () {
        var A = this.maxCharacterLength - this.textArea.value.length;
        return A > 0
    }, updateCharacterCount: function () {
        var A = this.maxCharacterLength - this.textArea.value.length;
        if (A >= 0) {
            this.characterCounterNumber.innerHTML = A
        }
    }, cropStatusIfNeeded: function () {
        if (!this.canWriteAnotherCharacter()) {
            var A = this.getCleanStatusText();
            this.textArea.value = A.substr(0, UserStatusZ.maxCharacterLength);
            this.updateCharacterCount()
        }
    }, getCleanStatusText: function () {
        return this.textArea.value.replace(/[\r\n]/g, "").replace(/^[ \t\r\n]+|[ \t\r\n]+$/g, "")
    }, isStatusTextDefault: function () {
        return this.getCleanStatusText() === this.defaultTipText
    }, isStatusTextEmpty: function () {
        return this.getCleanStatusText().length === 0
    }, commitStatusHandler: {
        url: undefined,
        post_params: undefined,
        bodyText: "",
        perform: function (A, D, C, B) {
            this.url = A;
            this.post_params = D;
            this.post_params[C] = B;
            this.bodyText = B;
            this.send()
        }, send: function () {
            Request.AJAX.send(this.url, this, false)
        }, after: function (B) {
            if (B.getAttribute("success")) {
                var A = $(UserStatusZ.newStatusDomId);
                UserStatusZ.reportSuccessfulCommit(A.innerHTML);
                A.innerHTML = "";
                if (UserStatusZ.statusWallIntegrated && $("wall") && this.bodyText.length > 0) {
                    UserStatusZ.wallReloadHandler.click()
                }
            } else {
                UserStatusZ.reportFailedCommit(B)
            }
        }
    }, commitCampaignStatusHandler: {
        view_params: undefined,
        url: undefined,
        post_params: undefined,
        perform: function (A) {
            if (typeof this.view_params !== "undefined") {
                this.url = this.view_params.url.htmlDecode();
                this.post_params = this.view_params.post_params;
                this.post_params[this.view_params.additional_params.body_param_name] = A;
                this.send()
            }
        }, send: function () {
            Request.AJAX.send(this.url, this, false)
        }, after: function (A) {}
    }, wallReloadHandler: {
        url: undefined,
        post_params: undefined,
        click: function () {
            this.url = UserStatusZ.reloadWallRequestConfig.url;
            this.send()
        }, send: function () {
            Request.AJAX.send(this.url, this, false)
        }, after: function (A) {
            if (A.getAttribute("success")) {
                Profile.profile_wall_filter.select_filter("wall_filter_all_link");
                var B = $("wall_posts_content");
                if (B) {
                    var C = B.getFirst();
                    if (C) {
                        UI.highligh_feedback(C, undefined, undefined, "#F5F5F5")
                    }
                }
            }
        }
    }, reportSuccessfulCommit: function (B) {
        this.resetTextArea();
        if (B.length > 0) {
            $("current_status_wrapper").show();
            $("current_status_date").hide();
            $("current_status_date_now").show();
            var A = $("current_status_body");
            var C = $(A.cloneNode(true));
            A.id = "current_status_body_old";
            C.innerHTML = B;
            var D = function (F, E) {
                return function () {
                    E.style.opacity = 0;
                    E.inject(F, "after");
                    F.remove();
                    Animation(E).to("opacity", 1).from(0).duration(500).ease(Animation.ease.end).go()
                }
            }(A, C);
            A.style.opacity = 1;
            Animation(A).to("opacity", 0).from(1).ondone(D).duration(250).ease(Animation.ease.end).go()
        } else {
            $("current_status_wrapper").hide();
            $("current_status_body").innerHTML = ""
        }
    }, reportFailedCommit: function (A) {
        FeedbackController.createFeedbackFromRequestData(A);
        this.resetTextArea();
        this.prepareTextAreaForEdit()
    }
};
UserStatusZ.reply = {
    url: undefined,
    post_params: undefined,
    feedback_submit_button: undefined,
    click_with_template: function (A, B, F, C, I) {
        this.url = A;
        this.post_params = B;
        var H = {
            "close_button": function () {
                UserStatusZ.reply.close();
                return false
            }, "submit_button": function () {
                UserStatusZ.reply.send();
                return false
            }
        };
        JSTemplates.load_template("js_template_status_comment_form", F, I.form_prefix, I.form_sufix, C, H);
        var G = $(I.form_prefix + "_media_bar_" + I.form_sufix);
        var E = $(I.form_prefix + "_textarea_" + I.form_sufix);
        var D = new MediaBarController(E, null, null, I.form_prefix, null);
        D.injectDefaultMediaBar(G);
        this.target_id = F;
        this.replacements = C;
        this.form_id = Hint.get_id_from_template(this.replacements._HTML_ID_PREFIX, "form", this.replacements._ID);
        this.open()
    }, send: function () {
        var A = $(this.form_id);
        var B = Request.AJAX.submit_form(this.url, this, A);
        if (B) {
            this.close()
        }
    }, after: function (B) {
        var A = $("blog_entry_form_textarea_error_feedback");
        if (A) {
            A.remove()
        }
        FeedbackController.createFeedbackFromRequestData(B)
    }, open: function () {
        var B = $(this.target_id);
        if (B) {
            B.show()
        }
        var A = $(this.form_id);
        if (A) {
            A.show()
        }
    }, close: function () {
        var B = $(this.target_id);
        if (B) {
            B.hide()
        }
        var A = $(this.form_id);
        if (A) {
            A.hide()
        }
    }
};
UserStatusZ.comments_notifications = {
    url: undefined,
    target: undefined,
    overlay: undefined,
    overlay_options: {}, destroy_notification: function () {
        if (this.overlay) {
            this.overlay.destroy();
            delete this.overlay
        }
    }, click: function (C, B, E) {
        if (this.overlay) {
            this.overlay.toggle()
        } else {
            RequestEngine._current_page = "home";
            this.url = C;
            this.target = E["request_target"];
            this.overlay_options["overlay_target"] = E["overlay_target"];
            var A, F;
            if (Browser.ie7) {
                A = -30;
                F = -30
            }
            var D = $("status_notifications_detail");
            if (D) {
                this.overlay = new Overlay({
                    content: D.getChildren()[0] || "",
                    hook: {}, targetPoint: {
                        element: this.overlay_options["overlay_target"],
                        position: "bl",
                        offsetY: F,
                        offsetX: A
                    }, sourcePoint: {
                        position: "tl"
                    }, close: {
                        event: "clickout",
                        destroy: false
                    }
                });
                this.overlay.show()
            }
        }
    }
};
load.trace("js/web2-Zero/actions/1_userstatus.js");
var Store = {
    _response_timeout: 2000
};
Store.add_to_cart = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    product_id: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = "add_to_cart_form";
        this.product_id = C.product_id;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, onchange: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = C.form_id;
        this.product_id = C.product_id;
        this.send()
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $id(this.form_id))
    }, before: function (A) {}, after: function (B) {
        if (B.getAttribute("success") == "1") {
            var A = "store_action_response_message_" + this.product_id;
            $(A).innerHTML = B.innerHTML;
            $(A).show();
            setTimeout(function () {
                $(A).hide()
            }, Store._response_timeout)
        }
    }, open: function () {}, close: function () {}
};
var Slideshow = {
    frame_size: 5,
    frame_offset: 0,
    list_size: 0,
    init: function () {
        var B = $("carousel_viewport_content").getChildren();
        this.list_size = 0;
        this.frame_offset = 0;
        for (var A = 0; A < B.length; A++) {
            if (B[A].tagName.toLowerCase() === "li") {
                this.list_size++
            }
        }
    }, render: function () {
        var A = $("carousel_viewport_content");
        var B = parseInt(A.getFirst().offsetWidth, 10);
        A.style.left = -(B * this.frame_offset) + "px"
    }, previous: function () {
        if (this.frame_offset > 0) {
            this.frame_offset--;
            this.render()
        }
    }, next: function () {
        if (this.frame_offset + this.frame_size < this.list_size) {
            this.frame_offset++;
            this.render()
        }
    }
};
var Checkout = {
    go_to_provider: function () {
        $("checkout_bridge_form").submit()
    }
};
load.trace("js/web2-Zero/actions/1_store.js");
load.trace("js/web2-Zero/actions/1_store_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    CanvasTrigger.extend({
        store: function () {
            if ($id("carousel")) {
                Slideshow.init()
            }
        }
    });
    LightBoxTrigger.extend({
        checkout_bridge_lightbox: function () {
            Checkout.go_to_provider()
        }
    })
});
load.trace("js/web2-Zero/actions/1_mobile_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    CanvasTrigger.extend({
        mobile: function () {
            UI.tab()
        }
    })
});
load.trace("js/web2-Zero/actions/1_terms_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    CanvasTrigger.extend({
        terms: function () {
            UI.tab()
        }
    })
});
load.trace("js/web2-Zero/actions/1_widgets_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    WidgetsTrigger.extend({
        widget_avatar: function (A) {
            UI.actions(A)
        }, event_avatar: function (A) {
            UI.actions(A)
        }, create_wall_post_form: function (A) {
            UI.growTextarea(A, 200, false);
            Profile.create_wall_post.create_wall_post_form_id = A;
            Profile.create_wall_post.wall_post_body_id = $(A).getElementsByPartialId("wall_post_body")[0].id;
            Profile.create_wall_post.textarea.init()
        }, photo_thumb: function (A) {
            UI.actions(A)
        }, page_settings_eventinfo: function (B) {
            var A = new UI.time($id("time"), $id("time_all_day"));
            if ($id("time_all_day").checked) {
                $id("time").style.display = "none"
            }
        }, page_settings_permissions: function (B) {
            var A = [];
            if (typeof AdditionalParams.get("SetupPermissionsPermittedUsers") !== "undefined") {
                A = AdditionalParams.get("SetupPermissionsPermittedUsers")[0]
            }
            Widget.Permissions.SponsoredEvent.init_multiplier("user_ids", "onfocus", A)
        }, exclusive_sponsorships: function (A) {
            if ($id(A) && (StateManager.getBrowserHash().match(/m=home/i) !== null)) {
                TConsole.info("[SPONSORSHIPS] Hiding sponsor bar");
                $(A).hide()
            } else {
                TConsole.info("[SPONSORSHIPS] Showing sponsor bar");
                $(A).show()
            }
        }, page_settings_richmedia: function (A) {
            Widget.Richmedia.description.prepareMediaBar()
        }
    });
    CanvasTrigger.extend({
        view_all_members_canvas: function () {
            if ($id("filter_list_form")) {
                People.filters.init_stubs();
                People.live_search.init()
            }
        }
    });
    StatusTrigger.extend({
        change_status_from_campaign_parameters: function (C) {
            if ($id(C)) {
                var B = $(C);
                var A = JSON.decode(B.innerHTML);
                if (typeof UserStatusZ !== "undefined") {
                    UserStatusZ.commitCampaignStatusHandler.view_params = A
                }
                B.remove()
            }
        }
    })
});
var Widget = {};
Widget.Permissions = {};
Widget.Permissions.SponsoredEvent = {
    multiplier: undefined,
    init_multiplier: function (C, B, A) {
        this.multiplier = new TextfieldMultiplier(C, B, A)
    }
};
Widget.Memberlist = {};
Widget.Memberlist.invite_friends = {
    url: undefined,
    post_params: undefined,
    friend_ids_already_invited: [],
    friend_ids_to_invite: [],
    feedback_submit_button: undefined,
    reset: function () {
        this.friend_ids_already_invited = [];
        this.friend_ids_to_invite = []
    }, click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.commit()
    }, commit: function () {
        var B = [];
        for (var A in this.friend_ids_to_invite) {
            if (!this.friend_ids_to_invite.hasOwnProperty(A)) {
                continue
            }
            B.push(this.friend_ids_to_invite[A])
        }
        this.post_params.friend_ids_to_invite = B.join(",");
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {
        if (A.getAttribute("success") == 1) {
            Widget.Memberlist.invite_friends.friend_ids_to_invite = {};
            if (typeof Widget.Memberlist.invite_friends.filter.default_text !== "undefined") {
                $("friend_filter").value = Widget.Memberlist.invite_friends.filter.default_text
            }
        }
    }, after: function (A) {
        if (A.getAttribute("success") == 1) {
            LightBox.close()
        }
        FeedbackController.createFeedbackFromRequestData(A)
    }, open: function () {
        this.friend_ids_to_invite = {};
        var B = $("memberlist_not_invited_friends_list").getChildren();
        for (var A = 0; A < B.length; A++) {
            var C = B[A];
            C.setAttribute("name", ClientSearchEngine.flatten_search_string(C.getAttribute("name")))
        }
    }, close: function () {}, add_friend: function (B, A) {
        $("remove_id_" + A).removeClass("hide");
        $("add_to_invitations_link_" + A).hide();
        $("added_to_invitations_span_" + A).show();
        $("already_invited_friends_list").getFirst().addClass("hide");
        if (typeof this.friend_ids_to_invite === "undefined") {
            this.friend_ids_to_invite = {}
        }
        this.friend_ids_to_invite["u" + A] = A
    }, remove_friend: function (B, A) {
        $("remove_id_" + A).addClass("hide");
        $("add_to_invitations_link_" + A).show();
        $("added_to_invitations_span_" + A).hide();
        delete this.friend_ids_to_invite["u" + A];
        if ($("already_invited_friends_list").getLast().className.match(/hide$/)) {
            $("already_invited_friends_list").getFirst().removeClass("hide")
        }
    }, filter: {
        default_text: undefined,
        focus: function () {
            var A = $("friend_filter");
            if (typeof this.default_text === "undefined") {
                this.default_text = A.value
            }
            if (A.value === this.default_text) {
                A.value = ""
            }
            A.addClass("active");
            A.removeClass("hint")
        }, blur: function () {
            var A = $("friend_filter");
            if (A.value.match(/^ *$/)) {
                A.value = this.default_text
            }
            A.removeClass("active");
            if (A.value == this.default_text) {
                A.addClass("hint")
            }
        }, change: function () {
            var A = $("friend_filter");
            var E = ClientSearchEngine.flatten_search_string(A.value);
            var D = $("memberlist_not_invited_friends_list").getChildren();
            for (var C = 0; C < D.length; C++) {
                var F = D[C];
                var B = F.getAttribute("name");
                if (B.indexOf(E) >= 0) {
                    F.show()
                } else {
                    F.hide()
                }
            }
        }
    }
};
Widget.Sponsorships = {};
Widget.Sponsorships.tracker = {
    url: undefined,
    post_params: undefined,
    click: function (B, A, D) {
        this.url = B;
        this.post_params = A;
        if (typeof D !== "undefined" && typeof D.tracking_pixels !== "undefined") {
            for (var C in D.tracking_pixels) {
                if (!D.tracking_pixels.hasOwnProperty(C)) {
                    continue
                }(new Image()).src = D.tracking_pixels[C]
            }
        }
        if (Widget.Sponsorships.tooltip.overlay) {
            Widget.Sponsorships.tooltip.overlayClose()
        }
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this, false)
    }, before: function (A) {}, after: function (A) {}
};
Widget.Sponsorships.tooltip = {
    url: undefined,
    post_params: undefined,
    unique_id: undefined,
    overlay: undefined,
    content_id: undefined,
    _timeout_ms: 150,
    _mouseout_timeout_ms: 150,
    image: undefined,
    original_image_src: undefined,
    hover_image_src: undefined,
    reset: function () {
        clearTimeout(this.timer);
        clearTimeout(this.mouseOutTimer);
        this.mouseOutTimer = setTimeout(function () {
            Widget.Sponsorships.tooltip.overlayClose()
        }, Widget.Sponsorships.tooltip._mouseout_timeout_ms)
    }, click: function (B, A, C) {
        clearTimeout(this.timer);
        clearTimeout(this.mouseOutTimer);
        if (this.image && this.original_image_src) {
            this.image.src = this.original_image_src
        }
        this.image = $(C.unique_id).getElementsByTagName("img")[0];
        this.original_image_src = this.image.src;
        this.hover_image_src = C.hover_image;
        this.timer = setTimeout(function () {
            Widget.Sponsorships.tooltip.overlayClose();
            Widget.Sponsorships.tooltip.trigger(B, A, C)
        }, Widget.Sponsorships.tooltip._timeout_ms)
    }, trigger: function (B, A, E) {
        this.url = B;
        this.post_params = A;
        this.unique_id = E.unique_id;
        this.content_id = E.content_id;
        var D = "";
        var C = {
            id: E.content_id
        };
        D = JSTemplates.get_template_string("js_template_exclusive_sponsorship_tooltip", C);
        D.id = E.content_id;
        this._render_overlay(D);
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this, false)
    }, before: function (A) {}, after: function (A) {
        if (Widget.Sponsorships.tooltip.overlay) {
            Widget.Sponsorships.tooltip.overlay.show();
            Widget.Sponsorships.tooltip.overlay.refresh()
        }
    }, overlayResize: function () {
        Widget.Sponsorships.tooltip.overlay.refresh()
    }, overlayClose: function () {
        Widget.Sponsorships.tooltip.image.src = Widget.Sponsorships.tooltip.original_image_src;
        if (this.overlay) {
            OverlayHierarchyMonitor.overlayDidClose(Widget.Sponsorships.tooltip.overlay);
            Widget.Sponsorships.tooltip.overlay.destroy();
            delete Widget.Sponsorships.tooltip.overlay
        }
    }, _render_overlay: function (E) {
        Widget.Sponsorships.tooltip.image.src = Widget.Sponsorships.tooltip.hover_image_src;
        var B = $(this.unique_id);
        var A = {
            content: E
        };
        A.overlayPage = new OverlayPage({
            background: false
        });
        A.hook = {};
        A.targetPoint = {
            element: B.id,
            position: "tm",
            follow: false,
            offsetX: -5,
            offsetY: 5
        };
        A.sourcePoint = {
            position: "bl",
            avoidShadow: {
                x: false,
                y: false
            }
        };
        Widget.Sponsorships.tooltip.overlay = new Overlay(A);
        var F = true;
        OverlayHierarchyMonitor.overlayDidOpen(Widget.Sponsorships.tooltip.overlay, F);
        Widget.Sponsorships.tooltip.overlay.show();
        var C = this;
        var D = $(Widget.Sponsorships.tooltip.overlay.getID());
        D.addEvent("mouseover", function () {
            if ($id(C.content_id)) {
                $(C.content_id).addClass("hover")
            }
            clearTimeout(C.mouseOutTimer)
        });
        D.addEvent("mouseout", function () {
            if ($id(C.content_id)) {
                $(C.content_id).removeClass("hover")
            }
            C.reset.apply(C)
        });
        D.addEvent("click", B.onclick)
    }
};
Widget.Voting = {};
Widget.Voting.VoteHandler = {
    url: undefined,
    post_params: undefined,
    additional_params: undefined,
    sender_element: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.additional_params = C;
        if (typeof C !== "undefined") {
            if (typeof C.vote !== "undefined") {
                this.post_params.vote = C.vote
            }
            if (typeof C.sender_id !== "undefined") {
                if ($id(C.sender_id)) {
                    this.sender_element = $(C.sender_id)
                }
            }
        }
        if (typeof this.sender_element !== "undefined") {
            if (!this.sender_element.hasClass("disabled")) {
                this.sender_element.addClass("disabled");
                this.sender_element.setAttribute("disabled", "disabled");
                this.send()
            }
        }
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, after: function (A) {}
};
Widget.Richmedia = {};
Widget.Richmedia.preview = {
    save: {
        url: undefined,
        post_params: undefined,
        additional_params: undefined,
        feedback_submit_button: undefined,
        form_id: undefined,
        click: function (B, A, C) {
            this.url = B;
            this.post_params = A;
            this.additional_params = C;
            this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
            this.form_id = C.form_id;
            this.send()
        }, send: function () {
            Request.AJAX.submit_form(this.url, this, $id(this.form_id))
        }, before: function (A) {
            if (LightBox.is_open()) {
                LightBox.close()
            }
        }, after: function (A) {
            FeedbackController.createFeedbackFromRequestData(A)
        }
    }
};
Widget.Richmedia.description = {
    prepareMediaBar: function () {
        var B = $("description");
        if (B) {
            if ($id("widget_richmedia_description_mediabar")) {
                var A = new MediaBarController(B, null, null, "page_settings", null);
                A.injectDefaultMediaBar($("widget_richmedia_description_mediabar"))
            }
        }
    }
};
Widget.Pageinfo = {};
Widget.Pageinfo.maininfo = {};
Widget.Pageinfo.maininfo.save = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = "page_maininfo_form";
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $id(this.form_id))
    }, before: function (A) {
        var B = JSON.decode(A.innerHTML);
        Validator.feedback.show(B.errors, $(this.form_id))
    }, after: function (A) {
        if (A.getAttribute("success")) {
            var B = JSON.decode(A.innerHTML);
            if (typeof B.awaiting_approval !== "undefined") {
                if (B.awaiting_approval == true) {
                    $("approval_required_feedback").removeClass("hide")
                }
            }
            if (typeof B.redirectUrl !== "undefined") {
                this.redirectionHandler.send(B.redirectUrl)
            }
        }
    }, open: function () {}, close: function () {}
};
Widget.Pageinfo.privacy = {};
Widget.Pageinfo.privacy.save = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = "privacy_form";
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $id(this.form_id))
    }, before: function (A) {
        var B = JSON.decode(A.innerHTML);
        Validator.feedback.show(B.errors, $(this.form_id))
    }, after: function (A) {}, open: function () {}, close: function () {}
};
Widget.Pageactions = {};
Widget.Pageactions.pageassociation = {};
Widget.Pageactions.pageassociation.change = {
    url: undefined,
    post_params: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {
        if ((typeof(this.additional_params.callback) !== "undefined") && A.getAttribute("success")) {
            this.additional_params.callback()
        }
        FeedbackController.createFeedbackFromRequestData(A)
    }, after: function (A) {
        if (A.getAttribute("success") == 1) {
            LightBox.init_with_simple_template({
                width: 300
            }, "js_template_success_message", {
                message: A.innerHTML
            }, null);
            setTimeout(function () {
                LightBox.close()
            }, LightBox.confirm_action_timeout)
        } else {
            LightBox.init_with_simple_template({
                width: 300
            }, "js_template_failed_request", {
                message: A.innerHTML
            }, null);
            setTimeout(function () {
                LightBox.close()
            }, LightBox.confirm_action_timeout)
        }
    }, open: function () {}, close: function () {}
};
Widget.Pageactions.request_access = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = C.form_id;
        this.show_message_in_people_page = C.show_message_in_people_page;
        LightboxHelper.createLightboxFromSimpleTemplate(C.js_template, C.replacements, {}, this, {
            "className": "mod formBox"
        });
        this.open()
    }, open: function () {
        LightBox.open()
    }, close: function () {
        LightBox.close()
    }, send: function (A) {
        Request.AJAX.submit_form(this.url, this, $(this.form_id))
    }, before: function (A) {}, after: function (A) {
        if (A.getAttribute("success")) {
            this.close()
        }
        FeedbackController.createFeedbackFromRequestData(A)
    }
};
Widget.MemberList = {};
Widget.MemberList.invitation = {
    removeBlock: function (A) {
        if ($id(A)) {
            $(A).hide()
        }
    }
};
Widget.FriendsAssociation = {};
Widget.FriendsAssociation.friend_updates = {
    url: undefined,
    post_params: undefined,
    unique_id: undefined,
    overlay: undefined,
    content_id: undefined,
    close_button_id: undefined,
    _timeout_ms: 100,
    _mouseout_timeout_ms: 250,
    last_time: undefined,
    reset: function () {
        clearTimeout(this.timer);
        clearTimeout(this.mouseOutTimer);
        this.mouseOutTimer = setTimeout(function () {
            Widget.FriendsAssociation.friend_updates.overlayClose()
        }, Widget.FriendsAssociation.friend_updates._mouseout_timeout_ms)
    }, click: function (B, A, C) {
        clearTimeout(this.timer);
        clearTimeout(this.mouseOutTimer);
        this.timer = setTimeout(function () {
            Widget.FriendsAssociation.friend_updates.overlayClose();
            Widget.FriendsAssociation.friend_updates.trigger(B, A, C)
        }, Widget.FriendsAssociation.friend_updates._timeout_ms)
    }, trigger: function (C, B, F) {
        this.url = C;
        this.post_params = B;
        this.unique_id = F.unique_id;
        this.content_id = F.content_id;
        this.close_button_id = F.close_button_id;
        this.last_time = F.last_time;
        var D = {};
        var E = "";
        if (this.last_time > 0) {
            D = {
                id: F.content_id,
                close_button_id: F.empty_results.close_button_id,
                close_button_title: F.empty_results.close_button_title,
                title: F.empty_results.title
            };
            E = JSTemplates.get_template_string("js_template_local_page_friend_updates_loading", D);
            E.id = F.content_id;
            this._render_overlay(E);
            this.send()
        } else {
            var A = F.empty_results_message;
            D = {
                id: F.content_id,
                close_button_id: F.empty_results.close_button_id,
                close_button_title: F.empty_results.close_button_title,
                title: F.empty_results.title,
                empty_results_message: F.empty_results.message
            };
            E = JSTemplates.get_template_string("js_template_local_page_friend_updates_empty", D);
            this._render_overlay(E)
        }
    }, send: function () {
        Request.AJAX.send(this.url, this, false)
    }, before: function (A) {}, after: function (A) {
        Widget.FriendsAssociation.friend_updates.overlay.show()
    }, overlayResize: function () {
        Widget.FriendsAssociation.friend_updates.overlay.refresh()
    }, overlayClose: function () {
        if (this.overlay) {
            OverlayHierarchyMonitor.overlayDidClose(Widget.FriendsAssociation.friend_updates.overlay);
            Widget.FriendsAssociation.friend_updates.overlay.destroy();
            delete Widget.FriendsAssociation.friend_updates.overlay
        }
    }, _render_overlay: function (E) {
        var B = $(this.unique_id);
        var A = {
            content: E
        };
        A.overlayPage = new OverlayPage({
            background: false
        });
        A.hook = {};
        A.close = {
            event: ["clickout", Widget.FriendsAssociation.friend_updates.close_button_id],
            action: function () {
                Widget.FriendsAssociation.friend_updates.overlayClose();
                return false
            }
        };
        A.targetPoint = {
            element: B.id,
            position: "bm",
            follow: false
        };
        A.sourcePoint = {
            position: "tm",
            avoidShadow: {
                x: false,
                y: false
            }
        };
        Widget.FriendsAssociation.friend_updates.overlay = new Overlay(A);
        var F = true;
        OverlayHierarchyMonitor.overlayDidOpen(Widget.FriendsAssociation.friend_updates.overlay, F);
        Widget.FriendsAssociation.friend_updates.overlay.show();
        var C = this;
        var D = $(Widget.FriendsAssociation.friend_updates.overlay.getID());
        D.addEvent("mouseover", function () {
            clearTimeout(C.mouseOutTimer)
        });
        D.addEvent("mouseout", function () {
            C.reset.apply(C)
        })
    }
};
Widget.Contest = {};
Widget.Contest.choosePhoto = {
    click: function (B, C, A) {
        PhotoChooser.open(this, B, null, A.savingUrl, null, A, true)
    }, photoChooserDidBeginUpload: function () {
        return false
    }, photoChooserDidSelectPhotos: function (B, C, A) {
        this.completeUrl = A.savingUrl;
        this.completeUrl += "&" + A.photo_key_param + "=" + encodeURIComponent(C);
        this.send()
    }, photoChooserDidClose: function () {}, photoChooserDidFailUploading: function () {
        return false
    }, send: function () {
        Request.AJAX.send(this.completeUrl, this)
    }
};
Widget.Generic = {};
Widget.Generic.VideoChooser = {
    completeUrl: undefined,
    post_params: undefined,
    staticVideoSearchOptions: undefined,
    staticVideoSearchTranslations: undefined,
    click: function (C, E, A) {
        this.url = C;
        this.post_params = E;
        if (typeof this.staticVideoSearchOptions === "undefined") {
            var D = $("media_bar_config");
            if (D && D.getAttr("config")) {
                var B = JSON.decode($("media_bar_config").getAttr("config")) || {};
                this.staticVideoSearchOptions = B.video_search_config;
                this.staticVideoSearchTranslations = B.video_search_translations;
                this.staticVideoSearchOptions.overrides = {};
                this.staticVideoSearchOptions.overrides.sourcePointPosition = "tl"
            }
        }
        this.buttonId = A.buttonId;
        this.htmlPrefix = A.htmlPrefix;
        this.htmlSuffix = A.htmlSuffix;
        this.videoParam = A.paramName;
        Videos.generic_search.open(this, $(this.buttonId), null, this.staticVideoSearchOptions, this.staticVideoSearchTranslations, this.htmlPrefix, this.htmlSuffix)
    }, addTextAction: function (A) {
        if (A) {
            this.post_params[this.videoParam] = A
        }
        this.send()
    }, overlayDidClose: function () {}, send: function () {
        Request.AJAX.send(this.url, this)
    }, after: function () {}
};
Widget.Generic.PhotoChooser = {
    completeUrl: undefined,
    post_params: undefined,
    click: function (B, C, A) {
        PhotoChooser.open(this, B, null, A.savingUrl, null, A, true)
    }, photoChooserDidBeginUpload: function () {
        return false
    }, photoChooserDidSelectPhotos: function (B, C, A) {
        if (typeof A.savingPostParams !== "undefined") {
            this.post_params = A.savingPostParams
        }
        this.completeUrl = A.savingUrl;
        this.completeUrl += "&" + A.photo_key_param + "=" + encodeURIComponent(C);
        this.send()
    }, photoChooserDidClose: function () {}, photoChooserDidFailUploading: function () {
        return false
    }, send: function () {
        Request.AJAX.send(this.completeUrl, this)
    }
};
Widget.Generic.SubmitWithFeedback = {
    click: function (B, A, D) {
        var C = {
            url: undefined,
            post_params: undefined,
            additional_params: undefined,
            click: function (F, E, G) {
                this.url = F;
                this.post_params = E;
                this.additional_params = G;
                this.send()
            }, send: function () {
                Request.AJAX.send(this.url, this)
            }, before: function () {}, after: function (E) {
                FeedbackController.createFeedbackFromRequestData(E)
            }
        };
        C.click(B, A, D)
    }
};
Widget.Generic.confirm = {
    save: {
        url: undefined,
        post_params: undefined,
        form_id: undefined,
        feedback_submit_button: undefined,
        click: function (B, A, C) {
            this.url = B;
            this.post_params = A;
            this.form_id = C.form_id;
            if (typeof(C.showConfirm) !== "undefined") {
                FeedbackController.createConfirmFeedback(C.message, DialogFeedback.types.ALERT, function () {
                    People.remove_friend.send();
                    return false
                })
            }
            this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
            this.send()
        }, send: function () {
            Request.AJAX.submit_form(this.url, this, $id(this.form_id))
        }, before: function (A) {
            var B = JSON.decode(A.innerHTML);
            Validator.feedback.show(B.errors, $(this.form_id))
        }, after: function (A) {}, open: function () {}, close: function () {}
    }
};
Widget.Generic.Settings = {
    save: {
        url: undefined,
        post_params: undefined,
        form_id: undefined,
        feedback_submit_button: undefined,
        click: function (B, A, C) {
            this.url = B;
            this.post_params = A;
            this.form_id = C.form_id;
            this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
            this.send()
        }, send: function () {
            Request.AJAX.submit_form(this.url, this, $id(this.form_id))
        }, before: function (A) {
            Validator.feedback.cleanup();
            var B = JSON.decode(A.innerHTML, true);
            if (B && typeof B === "object") {
                if (typeof B.errors !== "undefined") {
                    Validator.feedback.show(B.errors, $(this.form_id))
                }
            }
        }, after: function (A) {
            var B = JSON.decode(A.innerHTML, true);
            if (B && typeof B === "object") {
                if (typeof B.redirectTo !== "undefined") {
                    Request.standard_handler.click(B.redirectTo)
                }
                if (typeof B.awaiting_approval !== "undefined") {
                    if (B.awaiting_approval == true) {
                        $("approval_required_feedback").removeClass("hide")
                    }
                }
            }
            if (A.getAttribute("success") == 1) {
                if (typeof LightBox !== "undefined" && LightBox.is_open()) {
                    LightBox.close()
                }
            }
        }, open: function () {}, close: function () {}
    }
};
Widget.Generic.Toggler = {
    onchange: function (B, A, C) {
        this.click(B, A, C)
    }, click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {}, after: function (A) {
        FeedbackController.createFeedbackFromRequestData(A)
    }, open: function () {}, close: function () {}
};
Widget.Triggers = {
    process_all: function () {
        var D = $(document).getElementsByPartialId("trigger-");
        var C = D.length;
        var A = "";
        for (var B = 0; B < C; B++) {
            A = D[B].id;
            RequestEngine.AJAX.Web2ResponseHandler.XMPProcessor._process_triggers(A)
        }
        TConsole.info("Widget.Triggers: found ", C, " (", D, ")")
    }
};
load.trace("js/web2-Zero/actions/1_widgets.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    Widget.Triggers.process_all()
});
if (typeof Local === "undefined") {
    Local = {}
}
Local.goto_page_autofill = {
    autofill: undefined,
    url: undefined,
    post_params: undefined,
    init: function (A, B, C) {
        this.autofill = new Autofill(A, this, B, C, true)
    }, item_action: function (C, B, A, E, D, F) {
        this.url = C.replace(A, E);
        this.post_params = B;
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function () {}, after: function () {}
};
Local.edit_page = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    close_lightbox: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.close_lightbox = C.close_lightbox;
        this.form_id = C.form_id;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $(this.form_id), false)
    }, before: function (A) {}, after: function (A) {
        if (A.getAttribute("success") == 1 && this.close_lightbox) {
            LightBox.close()
        } else {
            LightBox.after(A);
            LightBox.resize()
        }
    }, open: function () {}, close: function () {}
};
Local.edit_page.categories_autofill = {
    autofill: undefined,
    init: function (A, B, C) {
        this.autofill = new Autofill(A, this, B, C, false)
    }, item_action: function (C, B, A, E, D, G) {
        var F = $(G.location_field_id);
        F.value = E
    }
};
Local.edit_page.neighborhoods_autofill = {
    autofill: undefined,
    init: function (A, B, C) {
        this.autofill = new Autofill(A, this, B, C, true)
    }, item_action: function (C, B, A, E, D, G) {
        var F = $(G.location_field_id);
        F.value = E
    }
};
Local.choosePhoto = {
    click: function (B, C, A) {
        PhotoChooser.open(this, B, null, A.savingUrl, null, A, true)
    }, photoChooserDidBeginUpload: function () {
        return false
    }, photoChooserDidSelectPhotos: function (B, C, A) {
        this.completeUrl = A.savingUrl;
        this.completeUrl += "&" + A.photo_key_param + "=" + encodeURIComponent(C);
        this.send()
    }, photoChooserDidClose: function () {}, photoChooserDidFailUploading: function () {
        return false
    }, send: function () {
        Request.AJAX.send(this.completeUrl, this)
    }
};
Local.share_page = {
    url: undefined,
    post_params: undefined,
    feedback_submit_button: undefined,
    disabling_message: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.button = C.button;
        if (!this.validate()) {
            return
        }
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $id("share_page_form"))
    }, before: function (A) {}, after: function (A) {
        if (A.getAttribute("success") == 1) {
            setTimeout(function () {
                LightBox.close()
            }, LightBox.confirm_action_timeout)
        }
    }, open: function (B, A) {}, close: function () {
        LightBox.close()
    }, validate: function () {
        if (isNaN(parseInt($("user_id_hidden").value))) {
            $("name_text_input").addClass("error");
            return false
        } else {
            $("name_text_input").removeClass("error");
            return true
        }
    }, autofill: {
        autofill: undefined,
        init: function (A, B, C) {
            this.autofill = new Autofill(A, this, B, C)
        }, item_action: function (C, B, A, E, D, F) {
            if (E) {
                $("user_id_hidden").value = E;
                $("message").focus();
                Local.share_page.disabling_message = F.disabling_message;
                Local.share_page.disabling_profile_wall_message = F.disabling_profile_wall_message;
                if (!F.is_messaging_disabled) {
                    Message.disabling.is_disabled(F.messaging_check_link, {
                        field_id: F.to_user_param,
                        value: E
                    }, Local.share_page.message_disabling_handler)
                }
                Profile.profile_wall_disabling.is_disabled(F.profile_wall_check_link, {
                    field_id: F.to_user_param,
                    value: E
                }, Local.share_page.profile_wall_disabling_handler)
            }
            Local.share_page.validate()
        }
    }, show_wall_button: function () {
        $("wall_button").show();
        $("private_message_button").hide()
    }, show_private_message_button: function () {
        $("private_message_button").show();
        $("wall_button").hide()
    }, message_disabling_handler: function (A) {
        if (A) {
            Local.share_page.disable_private_message_option()
        } else {
            Local.share_page.enable_private_message_option()
        }
    }, profile_wall_disabling_handler: function (A) {
        if (A) {
            Local.share_page.disable_profile_wall_option()
        } else {
            Local.share_page.enable_profile_wall_option()
        }
    }, enable_profile_wall_option: function () {
        $("wall_radio").removeAttribute("disabled");
        $("label_wall_radio").removeAttribute("title")
    }, disable_profile_wall_option: function () {
        if (!$("private_message_radio").getAttribute("disabled")) {
            $("private_message_radio").checked = true;
            Local.share_page.show_private_message_button()
        }
        $("wall_radio").checked = false;
        $("wall_radio").setAttribute("disabled", true);
        $("wall_radio").setAttribute("title", Local.share_page.disabling_profile_wall_message);
        $("label_wall_radio").setAttribute("title", Local.share_page.disabling_profile_wall_message)
    }, enable_private_message_option: function () {
        $("private_message_radio").removeAttribute("disabled");
        $("label_private_message_radio").removeAttribute("title")
    }, disable_private_message_option: function () {
        if (!$("wall_radio").getAttribute("disabled")) {
            $("wall_radio").checked = true;
            Local.share_page.show_wall_button()
        }
        $("private_message_radio").checked = false;
        $("private_message_radio").setAttribute("disabled", true);
        $("private_message_radio").setAttribute("title", Local.share_page.disabling_message);
        $("label_private_message_radio").setAttribute("title", Local.share_page.disabling_message)
    }
};
Local.add_wall_review = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = C.form_id;
        this.success_feedback_message = C.success_feedback_message;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $id(this.form_id))
    }, before: function (A) {}, after: function (A) {
        var B = JSON.decode(A.innerHTML);
        if (A.getAttribute("success") === "1") {
            LightBox.close()
        } else {
            Validator.feedback.show(B.errors, $(this.form_id))
        }
    }, open: function () {}, close: function () {}
};
Local.vote_review = {
    url: undefined,
    post_params: undefined,
    post_id: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.post_id = C.post_id;
        this.send()
    }, send: function () {
        $("wall_vote_review_" + this.post_id).onclick = function () {
            return false
        };
        Request.AJAX.send(this.url, this)
    }, after: function (A) {
        if (A.getAttribute("success")) {
            if ($("wall_vote_review_success_" + this.post_id)) {
                $("wall_vote_review_success_" + this.post_id).show()
            }
            if ($("wall_vote_review_link_" + this.post_id)) {
                $("wall_vote_review_link_" + this.post_id).remove()
            }
        }
    }
};
Local.set_review_locale = {
    click: function (B, A, C) {
        this.language_label = $("review_language_label");
        this.language_id = $("review_language_id");
        if (this.language_label && this.language_id) {
            this.language_label.innerHTML = C.locale_name;
            this.language_id.value = C.locale_id
        }
    }
};
Local.review_rating = {
    star_hover: function (A) {}
};
Local.add_to_my_local = {
    url: undefined,
    post_params: undefined,
    pop_follow_confirmation: false,
    pop_follow_confirmation_data: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.pop_follow_confirmation = C.pop_follow_confirmation;
        if (this.pop_follow_confirmation) {
            this.pop_follow_confirmation_data = {
                message: C.follow_confirmation_message,
                yes_label: C.follow_confirmation_yes_label,
                yes_onclick: function () {
                    Request.standard_handler.click(C.follow_confirmation_onclick.url, C.follow_confirmation_onclick.post_params)
                }, no_label: C.follow_confirmation_no_label
            }
        }
        this.send()
    }, send: function () {
        $("wall_vote_review_" + this.post_id).onclick = function () {
            return false
        };
        Request.AJAX.send(this.url, this)
    }, after: function (A) {
        if (this.pop_follow_confirmation && A.getAttribute("success").toInt() === 1) {
            FeedbackController.createConfirmFeedback(this.pop_follow_confirmation_data.message, DialogFeedback.types.SUCCESS, this.pop_follow_confirmation_data.yes_onclick, undefined, {
                acceptButton: this.pop_follow_confirmation_data.yes_label,
                cancelButton: this.pop_follow_confirmation_data.no_label
            })
        }
    }
};
Local.static_map = {
    _container: undefined,
    _canvas: undefined,
    _latitude: undefined,
    _longitude: undefined,
    _map: undefined,
    _marker: undefined,
    _is_lib_loaded: false,
    _is_lib_loading: false,
    switch_to_dynamic: function (C, B) {
        this._container = $(B);
        var A = $(C);
        if (A.width > 120) {
            return true
        }
        this._latitude = this._container.getAttribute("latitude");
        this._longitude = this._container.getAttribute("longitude");
        this._container.setHTML('<div id = "dynamic_map_canvas" class = "body" style="width:200px; height:200px; float:none; position:relative;"></div>');
        this._canvas = $("dynamic_map_canvas");
        Local.static_map.initialize()
    }, initialize: function () {
        TConsole.log("[Local.static_map] Render map...");
        if (!Local.static_map._is_lib_loaded) {
            if (!Local.static_map._is_lib_loading) {
                Local.static_map._is_lib_loading = true;
                GoogleApiClient.loadApi("maps", "2", function () {
                    Local.static_map._is_lib_loaded = true;
                    Local.static_map._is_lib_loading = false;
                    Local.static_map.initialize();
                    TConsole.log("[Local.static_map] Google maps ready")
                })
            }
            return false
        }
        var B = new google.maps.LatLng(this._latitude, this._longitude);
        Local.static_map._map = new google.maps.Map2(this._canvas);
        var A = new google.maps.LatLng(this._latitude, this._longitude);
        Local.static_map._marker = new google.maps.Marker(A, {
            draggable: false,
            bouncy: false,
            dragCrossMove: false,
            autoPan: false
        });
        Local.static_map._map.addOverlay(Local.static_map._marker);
        Local.static_map._map.setCenter(A);
        Local.static_map._map.setZoom(15)
    }
};
Local.ownership = {};
Local.ownership.start_process = {
    url: undefined,
    post_params: undefined,
    additional_params: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, after: function (A) {
        if (A.getAttribute("success")) {
            LightBox.close()
        }
    }
};
Local.ownership.process_form = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    feedback_submit_button: undefined,
    click: function (C, B, E) {
        var A = $("page_settings_submit_button").getChildren()[0].getChildren()[0];
        if (A.innerHTML.match(E.unlocked_form_message)) {
            this.url = C;
            this.post_params = B;
            this.form_id = E.form_id;
            this.success_feedback_message = E.success_feedback_message;
            this.feedback_submit_button = FormFeedback.submit_button(E.button, E.process_message, E.success_message, E.failure_message);
            this.send()
        } else {
            A.innerHTML = E.unlocked_form_message;
            for (var D = 0; D < E.locked_fields.length; D++) {
                field = $(E.locked_fields[D]);
                field.className = "";
                field.removeAttribute("disabled")
            }
        }
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $id(this.form_id))
    }, before: function (A) {}, after: function (A) {
        var B = JSON.decode(A.innerHTML);
        if (A.getAttribute("success") === "1") {
            var C = {
                ttl: 10000
            };
            FeedbackController.createSuccessFeedback(this.success_feedback_message, C)
        } else {
            Validator.feedback.show(B.errors, $(this.form_id))
        }
    }, open: function () {}, close: function () {}
};
load.trace("js/web2-Zero/actions/1_local.js");
if (typeof Local === "undefined") {
    Local = {}
}
Local.CreatePage = {
    form_id: undefined,
    field_name: undefined,
    field_postal_code: undefined,
    field_city_autofill: undefined,
    field_city: undefined,
    field_address: undefined,
    field_latitude: undefined,
    field_longitude: undefined,
    field_categories_autofill: undefined,
    field_categories: undefined,
    field_neighborhoods_autofill: undefined,
    field_neighborhoods: undefined,
    field_phonenumbers: undefined,
    field_websites: undefined,
    field_emails: undefined,
    div_page_suggestions: undefined,
    div_selected_result: undefined,
    div_categories_placeholder: undefined,
    div_map_canvas: undefined,
    div_neighborhoods_placeholder: undefined,
    div_email_errors_placeholder: undefined,
    div_phonenumbers_errors_placeholder: undefined,
    div_websites_errors_placeholder: undefined,
    suggestions_page_exists_link: undefined,
    translations: {
        suggestions_title: "",
        suggestions_other_text: "",
        suggestions_other_link_text: "",
        suggestions_page_exists_link: "",
        change_link_text: "",
        map_fail: ""
    }, url_parameter_placeholder: undefined,
    url_parameter_placeholder_alt: undefined,
    states: {
        START_OVER: 10,
        INITIAL: 11,
        RETRIEVED_NEW_SUGGESTIONS: 22,
        SELECTED_EXISTING_PAGE: 33,
        SELECTED_SUGGESTED_DATA: 44,
        SELECTED_NO_SUGGESTION: 55,
        RETRIEVED_EMPTY_SUGGESTIONS: 66
    }, _gsearch_ready: false,
    init: function () {
        TConsole.log("[Local.CreatePage] Initializing form...");
        var B = $("page_create_form").getAttr("config");
        B = JSON.decode(B);
        for (var A in B) {
            if (!B.hasOwnProperty(A)) {
                continue
            }
            this[A] = B[A]
        }
        Local.CreatePage.Suggestions.init();
        Local.CreatePage.Categories.init();
        Local.CreatePage.Neighborhoods.init();
        Local.CreatePage.PhoneNumbers.init(Local.CreatePage.field_phonenumbers, "onfocus", []);
        Local.CreatePage.Emails.init(Local.CreatePage.field_emails, "onfocus", []);
        Local.CreatePage.Map.init();
        Local.CreatePage.set_state(Local.CreatePage.states.INITIAL);
        TConsole.log("[Local.CreatePage] Finished form init!")
    }, set_state: function (B, A) {
        TConsole.log("[Local.CreatePage] Setting state " + B + "...", A);
        this.Categories.init();
        this.Neighborhoods.init();
        this.PhoneNumbers.multiplier.reset();
        this.Emails.multiplier.reset();
        this.set_coordinates("", "");
        this.set_postal_code("");
        $(this.field_websites).value = "";
        switch (B) {
        case this.states.START_OVER:
            this.set_initial_values();
        case this.states.INITIAL:
            this.show_items("STATE_INITIAL");
            this.hide_items("STATE_SUGGESTIONS");
            this.hide_items("STATE_FINAL");
            if (typeof A === "function") {
                A.call()
            }
            break;
        case this.states.RETRIEVED_NEW_SUGGESTIONS:
        case this.states.SELECTED_EXISTING_PAGE:
            this.hide_items("STATE_INITIAL");
            this.show_items("STATE_SUGGESTIONS");
            this.hide_items("STATE_FINAL");
            if (typeof A === "function") {
                A.call()
            }
            break;
        case this.states.RETRIEVED_EMPTY_SUGGESTIONS:
        case this.states.SELECTED_SUGGESTED_DATA:
        case this.states.SELECTED_NO_SUGGESTION:
            this.hide_items("STATE_INITIAL");
            this.hide_items("STATE_SUGGESTIONS");
            this.show_items("STATE_FINAL");
            if (typeof A === "function") {
                A.call()
            }
            this.Map.render();
            break;
        default:
        }
        if (LightBox.open()) {
            LightBox.resize()
        }
        Validator.feedback.cleanup();
        TConsole.log("[Local.CreatePage] Finishing set state to " + B + "!")
    }, show_items: function (C) {
        var B;
        var A = $(this.form_id).getClass(C);
        for (B in A) {
            if (!A.hasOwnProperty(B)) {
                continue
            }
            A[B].show()
        }
    }, hide_items: function (C) {
        var B;
        var A = $(this.form_id).getClass(C);
        for (B in A) {
            if (!A.hasOwnProperty(B)) {
                continue
            }
            A[B].hide()
        }
    }, set_initial_values: function () {
        $(this.field_name).value = this.last_lookup_name;
        $(this.field_address).value = this.last_lookup_address;
        $(this.field_city_autofill).value = this.last_lookup_city
    }, get_name: function () {
        return $(this.field_name).value.trim()
    }, get_address: function () {
        return $(this.field_address).value.trim()
    }, get_postal_code: function () {
        return $(this.field_postal_code).value.trim()
    }, get_city: function () {
        return $(this.field_city_autofill).value.trim()
    }, get_city_id: function () {
        return $(this.field_city).value.trim()
    }, set_coordinates: function (B, A) {
        TConsole.log("[Local.CreatePage] Setting new coordinates... (" + B + " " + A + ")");
        $(this.field_latitude).value = B;
        $(this.field_longitude).value = A
    }, set_postal_code: function (A) {
        TConsole.log("[Local.CreatePage] Setting new postal code... (" + A + ")");
        $(this.field_postal_code).value = A
    }
};
Local.CreatePage.Map = {
    _is_lib_preloading: false,
    _is_lib_loading: false,
    _is_lib_loaded: false,
    _map: undefined,
    _geocoder: undefined,
    _marker: undefined,
    _canvas: undefined,
    init: function () {
        this._map = undefined;
        this._geocoder = undefined;
        this._marker = undefined;
        this._canvas = $(Local.CreatePage.div_map_canvas);
        this._canvas.setHTML("");
        this.preload()
    }, preload: function () {
        if (!Local.CreatePage.Map._is_lib_loaded && !Local.CreatePage.Map._is_lib_preloading) {
            TConsole.log("[Local.CreatePage] Preload Google maps...");
            Local.CreatePage.Map._is_lib_preloading = true;
            GoogleApiClient.loadApi("maps", "2", function () {
                Local.CreatePage.Map._is_lib_loaded = true;
                Local.CreatePage.Map._is_lib_loading = false;
                Local.CreatePage.Map._is_lib_preloading = false;
                TConsole.log("[Local.CreatePage] Google maps preloaded!")
            })
        }
    }, render: function () {
        TConsole.log("[Local.CreatePage] Render map...");
        if (!Local.CreatePage.Map._is_lib_loaded) {
            if (!Local.CreatePage.Map._is_lib_loading) {
                Local.CreatePage.Map._is_lib_loading = true;
                GoogleApiClient.loadApi("maps", "2", function () {
                    Local.CreatePage.Map._is_lib_loaded = true;
                    Local.CreatePage.Map._is_lib_loading = false;
                    Local.CreatePage.Map._is_lib_preloading = false;
                    Local.CreatePage.Map.render();
                    TConsole.log("[Local.CreatePage] Google maps ready")
                })
            }
            return false
        }
        var B = Local.CreatePage.get_address();
        var A = "";
        var C = Local.CreatePage.get_postal_code();
        if (C === "") {
            A = Local.CreatePage.get_city()
        } else {
            A = C
        }
        if (google.maps.BrowserIsCompatible()) {
            Local.CreatePage.Map._map = new google.maps.Map2(Local.CreatePage.Map._canvas);
            Local.CreatePage.Map._map.disableDragging();
            var D = B + ", " + A + " spain";
            Local.CreatePage.Map._geocoder = new google.maps.ClientGeocoder();
            Local.CreatePage.Map._geocoder.getLatLng(D, function (E) {
                if (E) {
                    Local.CreatePage.Map._map.setCenter(E, 13);
                    Local.CreatePage.Map._map.setZoom(17);
                    Local.CreatePage.Map._marker = new google.maps.Marker(E, {
                        draggable: true,
                        bouncy: true,
                        dragCrossMove: true,
                        autoPan: false
                    });
                    Local.CreatePage.Map._map.addOverlay(Local.CreatePage.Map._marker);
                    google.maps.Event.addListener(Local.CreatePage.Map._marker, "dragend", function () {
                        var H = this.getPoint();
                        Local.CreatePage.set_coordinates(H.lat(), H.lng());
                        Local.CreatePage.Map._geocoder.getLocations(H, Local.CreatePage.Map._locations_callback)
                    });
                    var G = E.lat();
                    var F = E.lng();
                    Local.CreatePage.Map._geocoder.getLocations(E, Local.CreatePage.Map._locations_callback);
                    Local.CreatePage.set_coordinates(G, F)
                } else {
                    Local.CreatePage.Map._map_fail()
                }
            })
        } else {
            Local.CreatePage.Map._map_fail()
        }
        if (LightBox.is_open()) {
            LightBox.resize()
        }
        TConsole.log("[Local.CreatePage] Map rendered!")
    }, _map_fail: function () {
        TConsole.log("[Local.CreatePage] Map rendering failed!");
        Local.CreatePage.Map._canvas.setHTML(Local.CreatePage.translations.map_fail)
    }, _locations_callback: function (A) {
        if (!A || A.Status.code != 200) {
            TConsole("[Local.CreatePage] Failed to get postal code, failure status code:" + A.Status.code)
        } else {
            try {
                var C = A.Placemark[0].AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber;
                Local.CreatePage.set_postal_code(C)
            } catch (B) {
                TConsole.log("[Local.CreatePage] Postal code could not be found even though it should be there...");
                TConsole.log(B)
            }
        }
    }
};
Local.CreatePage.city_autofill = {
    autofill: undefined,
    _previously_selected_value: undefined,
    init: function (A, B, C) {
        LightBox.overlayLightbox.forceScreenFollow(false);
        this.autofill = new Autofill(A, this, B, C)
    }, item_action: function (C, B, A, E, D, F) {
        $(F.location_field_id).value = E;
        $(Local.CreatePage.field_city_autofill).value = D;
        if (D !== this._previously_selected_value) {
            Local.CreatePage.Neighborhoods.init()
        }
        Local.CreatePage.Neighborhoods.neighborhood_autofill.set_city_changed(F.city_for_neighborhood_id, E);
        this._previously_selected_value = D
    }
};
Local.CreatePage.Suggestions = {
    _name: false,
    _address: false,
    init: function () {
        this.Lookup.Google.preload()
    }, Lookup: {
        url: undefined,
        post_params: undefined,
        _has_tuenti_results: false,
        _tuenti_results: undefined,
        _has_google_results: false,
        _received_google: undefined,
        _timeout_google_results: undefined,
        _timeout_ms: 5000,
        click: function (D, C, E) {
            TConsole.log("[Local.CreatePage] Tuenti suggestions lookup...");
            var B = Local.CreatePage.get_name();
            var G = Local.CreatePage.get_city();
            var F = Local.CreatePage.get_city_id();
            var A = Local.CreatePage.get_address();
            Local.CreatePage.last_lookup_name = B;
            Local.CreatePage.last_lookup_address = A;
            Local.CreatePage.last_lookup_city = G;
            this.feedback_submit_button = FormFeedback.submit_button(E.button, E.process_message, E.success_message, E.failure_message);
            this.post_params = C;
            this.url = D;
            this.url = this.url.replace(E.url_parameter_placeholder, B);
            this.url = this.url.replace(E.url_parameter_placeholder_alt, A);
            this.url = this.url.replace(E.url_parameter_placeholder_alt2, F);
            if (B !== "" && F !== "" && A !== "") {
                clearTimeout(this._timeout_google_results);
                this._timeout_google_results = setTimeout(function () {
                    TConsole.log("[Local.CreatePage] Google results timeout...");
                    Local.CreatePage.Suggestions.Lookup.process_results(true)
                }, this._timeout_ms);
                Local.CreatePage.Suggestions.Lookup.Google.trigger(B, A, G)
            }
            this.send()
        }, send: function () {
            Request.AJAX.send(this.url, this)
        }, before: function (A) {
            if (A.getAttribute("success").toInt() === 1) {
                TConsole.log("[Local.CreatePage] Tuenti suggestions retrieved!");
                this._tuenti_results = JSON.decode(A.innerHTML);
                this._has_tuenti_results = true;
                Local.CreatePage.Suggestions.Lookup.process_results()
            } else {
                var B = JSON.decode(A.innerHTML);
                Validator.feedback.show(B.errors, $(Local.CreatePage.form_id));
                if (LightBox.is_open()) {
                    LightBox.resize()
                }
            }
        }, after: function (A) {}, Google: {
            _is_lib_preloading: false,
            _is_lib_loading: false,
            _is_lib_loaded: false,
            _localSearch: undefined,
            preload: function () {
                if (!Local.CreatePage.Suggestions.Lookup.Google._is_lib_loaded && !Local.CreatePage.Suggestions.Lookup.Google._is_lib_preloading) {
                    TConsole.log("[Local.CreatePage] Preload Google search...");
                    Local.CreatePage.Suggestions.Lookup.Google._is_lib_preloading = true;
                    GoogleApiClient.loadApi("search", "1", function () {
                        Local.CreatePage.Suggestions.Lookup.Google._is_lib_loaded = true;
                        Local.CreatePage.Suggestions.Lookup.Google._is_lib_preloading = false;
                        Local.CreatePage.Suggestions.Lookup.Google._is_lib_loading = false;
                        TConsole.log("[Local.CreatePage] Google search preloaded!")
                    })
                }
            }, trigger: function (B, A, C) {
                if (this._is_lib_loaded) {
                    TConsole.log("[Local.CreatePage] Google suggestions lookup...");
                    this._localSearch = new google.search.LocalSearch();
                    this._localSearch.setNoHtmlGeneration();
                    this._localSearch.setSearchCompleteCallback(Local.CreatePage.Suggestions.Lookup.Google, Local.CreatePage.Suggestions.Lookup.Google.searchComplete);
                    this._localSearch.execute(B + " " + C)
                } else {
                    if (!this._is_lib_loading) {
                        this._is_lib_loading = true;
                        GoogleApiClient.loadApi("search", "1", function () {
                            TConsole.log("[Local.CreatePage] Google suggestions lookup ready for search");
                            Local.CreatePage.Suggestions.Lookup.Google._is_lib_loaded = true;
                            Local.CreatePage.Suggestions.Lookup.Google._is_lib_loading = false;
                            Local.CreatePage.Suggestions.Lookup.Google._is_lib_preloading = false;
                            Local.CreatePage.Suggestions.Lookup.Google.trigger(B, A, C)
                        })
                    }
                }
            }, searchComplete: function () {
                TConsole.log("[Local.CreatePage] Got Google search results!");
                clearTimeout(Local.CreatePage.Suggestions.Lookup._timeout_google_results);
                var K = [];
                var I = this._localSearch.results;
                if (I && I.length > 0) {
                    for (var J = 0; J < I.length; J++) {
                        var B = I[J].titleNoFormatting;
                        var L = I[J].streetAddress;
                        var H = I[J].city;
                        if (H === "") {
                            break
                        }
                        var D = I[J].region;
                        var C = I[J].country;
                        var E = I[J].addressLines.join(",");
                        var A = I[J].addressLines[1].match(/\d{5}/);
                        if (A !== null) {
                            A = (typeof A[0] === "undefined" ? "" : A[0])
                        } else {
                            A = ""
                        }
                        var G = [];
                        for (var M in I[J].phoneNumbers) {
                            if (!I[J].phoneNumbers.hasOwnProperty(M)) {
                                continue
                            }
                            G.push(I[J].phoneNumbers[M].number)
                        }
                        var F = {};
                        F[Local.CreatePage.field_name] = B;
                        F[Local.CreatePage.field_address] = L;
                        F[Local.CreatePage.field_postal_code] = A;
                        F[Local.CreatePage.field_city_autofill] = H;
                        F[Local.CreatePage.field_phonenumbers] = G;
                        K.push(F)
                    }
                }
                Local.CreatePage.Suggestions.Lookup._google_results = K;
                Local.CreatePage.Suggestions.Lookup._has_google_results = true;
                Local.CreatePage.Suggestions.Lookup.process_results()
            }
        }, process_results: function (D) {
            if (D !== true) {
                D = false
            }
            if (D || (this._has_tuenti_results && this._has_google_results)) {
                TConsole.log("[Local.CreatePage] Have final results, render suggestions");
                this._has_google_results = false;
                this._has_tuenti_results = false;
                var G = this._tuenti_results.length > 0;
                var B = typeof this._google_results !== "undefined" && this._google_results.length > 0;
                var E = G || B;
                if (E) {
                    var F = $(Local.CreatePage.div_page_suggestions);
                    F.setHTML("");
                    var C;
                    var J;
                    var A;
                    var H = "";
                    if (G) {
                        for (C = 0; C < this._tuenti_results.length; C++) {
                            J = this._tuenti_results[C];
                            var I = Local.CreatePage.suggestions_page_exists_link.replace(Local.CreatePage.url_parameter_placeholder, J.pageKey);
                            A = {
                                onclick: I,
                                name: J.name,
                                address: J.address,
                                city: J.city
                            };
                            H += JSTemplates.get_template_string("js_template_local_page_suggestion_item", A)
                        }
                    } else {
                        if (B) {
                            for (C = 0; C < this._google_results.length; C++) {
                                J = this._google_results[C];
                                A = {
                                    onclick: "Local.CreatePage.Suggestions.set_selected_suggestion(" + htmlspecialchars(JSON.encode(J)) + "); return false;",
                                    name: J[Local.CreatePage.field_name],
                                    address: J[Local.CreatePage.field_address],
                                    city: J[Local.CreatePage.field_city_autofill]
                                };
                                H += JSTemplates.get_template_string("js_template_local_page_suggestion_item", A)
                            }
                        }
                    }
                    A = {
                        title: Local.CreatePage.translations.suggestions_title,
                        other_text: Local.CreatePage.translations.suggestions_other_text,
                        other_link_text: Local.CreatePage.translations.suggestions_other_link_text,
                        list_items: H
                    };
                    H = JSTemplates.get_template_string("js_template_local_page_suggestion_item_list", A);
                    F.setHTML(H);
                    Local.CreatePage.set_state(Local.CreatePage.states.RETRIEVED_NEW_SUGGESTIONS)
                } else {
                    Local.CreatePage.set_state(Local.CreatePage.states.RETRIEVED_EMPTY_SUGGESTIONS);
                    Local.CreatePage.Suggestions._set_selection(Local.CreatePage.last_lookup_name, Local.CreatePage.last_lookup_address, Local.CreatePage.last_lookup_city)
                }
            }
        }
    }, set_selected_suggestion: function (A) {
        this._set_selection(A[Local.CreatePage.field_name], A[Local.CreatePage.field_address], A[Local.CreatePage.field_city_autofill]);
        Local.CreatePage.set_state(Local.CreatePage.states.SELECTED_SUGGESTED_DATA, function () {
            for (var D in A) {
                if (!A.hasOwnProperty(D)) {
                    continue
                }
                var E = $(D);
                if (E) {
                    E.value = A[D]
                } else {
                    if (D === Local.CreatePage.field_phonenumbers) {
                        var B = A[D];
                        for (var C in B) {
                            if (!B.hasOwnProperty(C)) {
                                continue
                            }
                            Local.CreatePage.PhoneNumbers.multiplier.add_item_from_initial_data(B[C])
                        }
                    }
                }
            }
        })
    }, set_selected_other: function () {
        this._set_selection(Local.CreatePage.last_lookup_name, Local.CreatePage.last_lookup_address, Local.CreatePage.last_lookup_city);
        Local.CreatePage.set_state(Local.CreatePage.states.SELECTED_NO_SUGGESTION)
    }, set_selected_existing: {
        url: undefined,
        post_params: undefined,
        form_id: undefined,
        click: function (B, A, C) {
            this.url = B;
            this.post_params = A;
            this.send()
        }, send: function () {
            Request.AJAX.send(this.url, this)
        }, before: function (A) {}, after: function (A) {
            Local.CreatePage.set_state(Local.CreatePage.states.SELECTED_EXISTING_PAGE)
        }
    }, _set_selection: function (B, A, C) {
        B = B.htmlEncode() || "";
        A = A.htmlEncode() || "";
        C = C.htmlEncode() || "";
        replacements = {
            name: B,
            address: A,
            city: C,
            change_link_text: Local.CreatePage.translations.change_link_text
        };
        result = JSTemplates.get_template_string("js_template_local_page_selected_suggestion", replacements);
        $(Local.CreatePage.div_selected_result).setHTML(result)
    }
};
Local.CreatePage.Categories = {
    _selected_items: {}, init: function () {
        this._selected_items = {};
        this.render()
    }, add_item: function (B, A) {
        this._selected_items[B] = A;
        this.render()
    }, remove_item: function (A) {
        delete this._selected_items[A];
        this.render()
    }, actualize_hidden_text_field: function (A) {
        $(Local.CreatePage.field_categories).value = A
    }, render: function () {
        var C = $(Local.CreatePage.div_categories_placeholder);
        C.setHTML("");
        var B;
        var E = "";
        var A = [];
        for (var D in this._selected_items) {
            if (!this._selected_items.hasOwnProperty(D)) {
                continue
            }
            A.push(D);
            B = {
                name: this._selected_items[D],
                onclick_fn: "Local.CreatePage.Categories.remove_item(" + D + "); return false;"
            };
            E += JSTemplates.get_template_string("js_template_tag_item", B)
        }
        this.actualize_hidden_text_field(A);
        B = {
            tags_templates: E
        };
        E = JSTemplates.get_template_string("js_template_tag_item_list", B);
        C.setHTML(E);
        if (A.length > 0) {
            C.show()
        } else {
            C.hide()
        }
        if (LightBox.is_open()) {
            LightBox.resize()
        }
    }, category_autofill: {
        autofill: undefined,
        init: function (A, B, C) {
            this.autofill = new Autofill(A, this, B, C, false)
        }, item_action: function (C, B, A, E, D, F) {
            Local.CreatePage.Categories.add_item(E, D)
        }
    }
};
Local.CreatePage.Neighborhoods = {
    _selected_items: {}, init: function () {
        this._selected_items = {};
        this.render()
    }, add_item: function (B, A) {
        this._selected_items[B] = A;
        this.render()
    }, remove_item: function (A) {
        delete this._selected_items[A];
        this.render()
    }, actualize_hidden_text_field: function (A) {
        $(Local.CreatePage.field_neighborhoods).value = A
    }, render: function () {
        var C = $(Local.CreatePage.div_neighborhoods_placeholder);
        C.setHTML("");
        var B;
        var E = "";
        var A = [];
        for (var D in this._selected_items) {
            if (!this._selected_items.hasOwnProperty(D)) {
                continue
            }
            A.push(D);
            B = {
                name: this._selected_items[D],
                onclick_fn: "Local.CreatePage.Neighborhoods.remove_item(" + D + "); return false;"
            };
            E += JSTemplates.get_template_string("js_template_tag_item", B)
        }
        this.actualize_hidden_text_field(A);
        B = {
            tags_templates: E
        };
        E = JSTemplates.get_template_string("js_template_tag_item_list", B);
        C.setHTML(E);
        if (A.length > 0) {
            C.show()
        } else {
            C.hide()
        }
        if (LightBox.is_open()) {
            LightBox.resize()
        }
    }, neighborhood_autofill: {
        autofill: undefined,
        _delayed_city_key: undefined,
        _delayed_city_id: undefined,
        init: function (A, B, C) {
            this.autofill = new Autofill(A, this, B, C);
            this.set_city_changed(this._delayed_city_key, this._delayed_city_id)
        }, set_city_changed: function (A, B) {
            if (typeof this.autofill === "undefined") {
                this._delayed_city_key = A;
                this._delayed_city_id = B
            } else {
                this.autofill.set_get_param(A, B)
            }
        }, item_action: function (C, B, A, E, D, F) {
            Local.CreatePage.Neighborhoods.add_item(E, D)
        }
    }
};
Local.CreatePage.PhoneNumbers = {
    multiplier: undefined,
    init: function (C, B, A) {
        this.multiplier = new TextfieldMultiplier(C, B, A)
    }
};
Local.CreatePage.Emails = {
    multiplier: undefined,
    init: function (C, B, A) {
        this.multiplier = new TextfieldMultiplier(C, B, A)
    }
};
Local.CreatePage.submit_form = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = Local.CreatePage.form_id;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        Local.CreatePage.PhoneNumbers.multiplier.clean_empty_fields();
        Local.CreatePage.Emails.multiplier.clean_empty_fields();
        this.send()
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $(this.form_id), false)
    }, before: function (A) {}, after: function (C) {
        if (typeof C !== "undefined") {
            var D = JSON.decode(C.innerHTML);
            if (C.getAttribute("success") === "1") {
                if (LightBox.is_open()) {
                    LightBox.close()
                }
                if (D !== null) {
                    if (typeof D.redirect_url === "string") {
                        this.redirectionHandler.send(D.redirect_url)
                    } else {
                        if (typeof D.message === "string" && D.message !== "") {
                            var E = {
                                ttl: 10000
                            };
                            FeedbackController.createSuccessFeedback(D.message, E)
                        }
                    }
                }
            } else {
                var A = {};
                for (var B = 0; B < 5; B++) {
                    A[Local.CreatePage.field_emails + B] = {
                        error_placement_id: Local.CreatePage.div_email_errors_placeholder
                    };
                    A[Local.CreatePage.field_phonenumbers + B] = {
                        error_placement_id: Local.CreatePage.div_phonenumbers_errors_placeholder
                    };
                    A[Local.CreatePage.field_websites + B] = {
                        error_placement_id: Local.CreatePage.div_websites_errors_placeholder
                    }
                }
                Validator.feedback.show(D.errors, $(this.form_id), A);
                if (LightBox.is_open()) {
                    LightBox.resize()
                }
            }
        }
    }, redirectionHandler: {
        url: undefined,
        post_params: undefined,
        send: function (A) {
            this.url = A;
            Request.AJAX.send(this.url, this)
        }, before: function () {}, after: function () {
            LightBox.close()
        }
    }
};
load.trace("js/web2-Zero/actions/1_local_create_page.js");
load.trace("js/web2-Zero/actions/1_local_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    LightBoxTrigger.extend({
        local_page_create: function () {
            Local.CreatePage.init()
        }, light_box: function () {
            if ($("val_review")) {
                var A = null;
                UI.growTextarea("val_review", 200, false, function () {
                    var C = $("val_review");
                    if (A === null) {
                        A = parseInt(C.getStyle("height"), 10)
                    }
                    var B = parseInt(C.getStyle("height"), 10);
                    if (B > A + 25) {
                        LightBox.overlayLightbox.forceScreenFollow(false)
                    } else {
                        LightBox.overlayLightbox.resetScreenFollow()
                    }
                })
            }
        }
    })
});
var Games = {
    _config: undefined,
    translations: undefined,
    init: function () {
        if ($("games_config")) {
            this._config = JSON.decode($("games_config").getAttribute("config"));
            this.translations = this._config.translations
        }
    }
};
Games.redirectionHandler = {
    go: function (A) {
        var B = {
            url: undefined,
            post_params: undefined,
            send: function (C) {
                this.url = C;
                Request.AJAX.send(this.url, this)
            }, before: function () {
                LightBox.close()
            }, after: function () {}
        };
        B.send(A)
    }, goToGame: function (C, B) {
        var A = Games._config.game_page_url.replace(Games._config.page_key_placeholder, C);
        A = A.replace(Games._config.game_token_placeholder, B);
        this.go(A)
    }
};
Games.create = {
    url: undefined,
    post_params: undefined,
    form_id: undefined,
    feedback_submit_button: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.form_id = C.form_id;
        this.feedback_submit_button = FormFeedback.submit_button(C.button, C.process_message, C.success_message, C.failure_message);
        this.send()
    }, send: function () {
        Request.AJAX.submit_form(this.url, this, $(this.form_id), false)
    }, before: function (A) {}, after: function (A) {
        var B = JSON.decode(A.innerHTML);
        if (A.getAttribute("success")) {
            Games.redirectionHandler.go(B.redirectUrl)
        } else {
            Validator.feedback.show(B.errors, $(this.form_id));
            LightBox.resize()
        }
    }, open: function () {}, close: function () {}
};
Games.showPage = {
    url: undefined,
    post_params: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        if (C.disclaimer != "") {
            FeedbackController.createConfirmFeedback(C.disclaimer, DialogFeedback.types.INFO, function () {
                Games.showPage.send();
                return false
            })
        } else {
            this.send()
        }
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {}, after: function (A) {}, open: function () {}, close: function () {}
};
Games.acknowledge_disclaimer = {
    url: undefined,
    post_params: undefined,
    click: function (B, A, C) {
        this.url = B;
        this.post_params = A;
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {}, after: function (A) {}, open: function () {}, close: function () {}
};
Games.stats = {
    tab: function (E) {
        var B = "chart_div_" + E;
        var A = "stats_tab_" + E;
        GoogleVisualizationClient.currentTab = E;
        var D = $("stats_tabs").getChildren();
        for (var C in D) {
            if (!D.hasOwnProperty(C)) {
                continue
            }
            if (D[C].id == A) {
                D[C].addClass("active")
            } else {
                D[C].removeClass("active")
            }
        }
        D = $("charts").getChildren();
        for (var C in D) {
            if (!D.hasOwnProperty(C)) {
                continue
            }
            if (D[C].id == B) {
                D[C].show()
            } else {
                D[C].hide()
            }
        }
    }
};
Games.challenge_friends = {
    USERS_TO_SHOW: 10,
    overlay: undefined,
    enabled: true,
    show_dialog: function (B, C) {
        if (this.enabled) {
            this.enabled = false;
            setTimeout(function () {
                Games.challenge_friends.enabled = true
            }, 500);
            if (ChatUIController.is_logged_in()) {
                var A = ChatUserFactory.getOnlineDesktopUsers();
                if (A.length > 0) {
                    this._show_friends_list(A, B, C)
                } else {
                    this._show_no_friends_online()
                }
            } else {
                this._show_is_offline()
            }
        }
    }, _show_friends_list: function (H, A, E) {
        var L = this;
        var B = {
            "close_button": Games.translations.close_button,
            "title": Games.translations.challenge_friend_dialog_title
        };
        var J = JSTemplates.load_template_element("js_template_game_invite_list", B, {});
        var M = ChatUIConversationFactory._config.avatar_size || 20;
        var C = $(J).getChildById("challenge_friend_game_list");
        if (H.length > this.USERS_TO_SHOW) {
            $(J).getChildById("challenge_friend_game_div").addClass("scroll")
        }
        var I;
        var F;
        for (var G = 0; G < H.length; G++) {
            F = H[G];
            var D = {
                "user_name": F.get_name_and_first_surname(),
                "avatar_url": F.avatar_url,
                "avatar_size": M,
                "avatar_x": F.avatar_x,
                "avatar_y": F.avatar_y
            };
            var K = function (N) {
                return {
                    "invite_from_list": function () {
                        var O = Games.getToken(N.id);
                        L.send_challenge(O, A, E, N.id);
                        L.close()
                    }, "avatar_image": {
                        "event_type": "load",
                        "callback_function": function (P) {
                            var O = get_event_target(P);
                            UI.overflow_avatar(O, {
                                size: M,
                                x: O.getAttribute("x"),
                                y: O.getAttribute("y")
                            });
                            return false
                        }
                    }
                }
            }(F);
            I = JSTemplates.load_template_element("js_template_game_invite_list_item", D, K, null, F.id, true);
            C.appendChild(I)
        }
        $(C).getFirst().addClass("first");
        this._open(J)
    }, _show_no_friends_online: function () {
        var A = {
            "close_button": Games.translations.close_button,
            "title": Games.translations.challenge_friend_dialog_title,
            "message": Games.translations.challenge_friend_dialog_no_friends_online
        };
        var B = JSTemplates.load_template_element("js_template_game_invite_no_friends_online", A, {});
        this._open(B)
    }, _show_is_offline: function () {
        var A = {
            "close_button": Games.translations.close_button,
            "message": Games.translations.challenge_friend_dialog_not_online
        };
        var B = JSTemplates.load_template_element("js_template_game_invite_not_online", A, {});
        this._open(B)
    }, _open: function (A) {
        var B;
        if (LightBox.is_open() && LightBox.overlayLightbox.overlayPage) {
            B = LightBox.overlayLightbox.overlayPage
        } else {
            B = new OverlayPage({
                background: false
            })
        }
        var C = false;
        if (typeof LightBox !== "undefined" && LightBox.is_open()) {
            C = LightBox.overlayLightbox.isFollowing()
        }
        this.overlay = new Overlay({
            overlayPage: B,
            content: A,
            hook: {}, focus: {
                event: "click"
            }, targetPoint: {
                element: $id("challenge_friend_button").id,
                position: "br",
                follow: C
            }, sourcePoint: {
                position: "tr",
                avoidShadow: {
                    x: false,
                    y: false
                }
            }, close: {
                event: ["clickout"]
            }
        });
        this.overlay.show();
        OverlayHierarchyMonitor.overlayDidOpen(this.overlay, true)
    }, close: function () {
        OverlayHierarchyMonitor.overlayDidClose(this.overlay)
    }, send_challenge: function (B, C, D, A) {
        Chat.actions.send_special_message("Game request", ChatUserFactory.get_user(A).jid, ChatSpecialMessagesMap.GAME_REQUEST, JSON.encode({
            token: B,
            pageKey: C,
            gameName: D,
            action: "challenge"
        }))
    }
};
Games.show_description = {
    overlay: undefined,
    open: function (A, F, C) {
        if (this.overlay) {
            this.close()
        }
        var B = {
            "close_button": Games.translations.close_button,
            "game_title": F,
            "game_description": C
        };
        var D = JSTemplates.load_template_element("js_template_game_description", B);
        var E;
        if (LightBox.is_open() && LightBox.overlayLightbox.overlayPage) {
            E = LightBox.overlayLightbox.overlayPage
        } else {
            E = new OverlayPage({
                background: false
            })
        }
        var G = false;
        if (typeof LightBox !== "undefined" && LightBox.is_open()) {
            G = LightBox.overlayLightbox.isFollowing()
        }
        this.overlay = new Overlay({
            overlayPage: E,
            content: D,
            hook: {}, focus: {
                event: "click"
            }, targetPoint: {
                element: A,
                position: "bm",
                follow: G
            }, sourcePoint: {
                position: "tm",
                avoidShadow: {
                    x: false,
                    y: false
                }
            }, close: {
                event: ["clickout", "close_light_box"],
                action: function () {
                    Games.show_description.close();
                    return false
                }
            }
        });
        this.overlay.show();
        OverlayHierarchyMonitor.overlayDidOpen(this.overlay, true)
    }, isOpen: function () {
        return this.overlay
    }, close: function () {
        OverlayHierarchyMonitor.overlayDidClose(this.overlay)
    }
};
Games.getToken = function (A) {
    return hex_md5(VIEWER_ID + A + new Date().getTime())
};
Games.gamePicker = function (A) {
    this._conversation = A;
    this._user = this._conversation.get_user();
    this._user.is_present() ? this.enable() : this.disable()
};
Games.gamePicker.prototype = {
    _overlay: undefined,
    _contentHandler: undefined,
    _conversation: undefined,
    _user: undefined,
    _enabled: false,
    _isOpen: false,
    click: function () {
        if (this._enabled && !this._isOpen) {
            this.highlight();
            this.getContentHandler().send()
        }
    }, open: function () {
        this._isOpen = true;
        this._overlay.show();
        OverlayHierarchyMonitor.overlayDidOpen(this._overlay, true)
    }, close: function () {
        this._isOpen = false;
        OverlayHierarchyMonitor.overlayDidClose(this._overlay);
        this.dim()
    }, highlight: function () {
        if (typeof this._user !== "undefined") {
            $("dock_item_game_picker_" + this._user.id).addClass("active")
        }
    }, dim: function () {
        if (typeof this._user !== "undefined") {
            $("dock_item_game_picker_" + this._user.id).removeClass("active")
        }
    }, enable: function () {
        this._enabled = true;
        if (typeof this._user !== "undefined") {
            $("dock_item_game_picker_" + this._user.id).removeClass("disabled")
        }
        this._updateGameChallengeButtons(function (A) {
            A.removeClass("disabled")
        })
    }, disable: function () {
        this._enabled = false;
        this.close();
        if (typeof this._user !== "undefined") {
            $("dock_item_game_picker_" + this._user.id).addClass("disabled")
        }
        this._updateGameChallengeButtons(function (A) {
            A.addClass("disabled")
        })
    }, _updateGameChallengeButtons: function (D) {
        var A = ChatUIConversationFactory.get_conversation_view(this._conversation).get_conversation_dom_element().getElementsByPartialId("_game_request_received_");
        var C;
        for (var B in A) {
            if (!A.hasOwnProperty(B)) {
                continue
            }
            C = A[B].getElement("button");
            if (typeof C !== "undefined") {
                D(C)
            }
        }
    }, cancelAllChallenges: function () {
        var A = Games.challengeStore.getAllByUser(this._user);
        for (var B in A) {
            if (!A.hasOwnProperty(B)) {
                continue
            }
            A[B].cancel()
        }
    }, getContentHandler: function () {
        if (typeof this._contentHandler === "undefined") {
            var A = this;
            this._contentHandler = {
                url: undefined,
                post_params: undefined,
                send: function () {
                    Request.AJAX.send(this.url, this)
                }, before: function (D) {
                    var C = document.createElement("div");
                    C.id = Games._config.overlay_target_id;
                    var B = {
                        "id": "lightbox_game_picker_overlay",
                        "content": C
                    };
                    B.overlayPage = new OverlayPage({
                        background: false
                    });
                    B.close = {
                        event: ["clickout", "game_picker_close_button"],
                        action: function () {
                            A.close();
                            return false
                        }
                    };
                    B.hook = {};
                    B.targetPoint = {
                        element: "dock_item_game_picker_" + A._user.id,
                        position: "rm",
                        follow: true,
                        offsetY: 4
                    };
                    B.sourcePoint = {
                        position: "lb",
                        avoidShadow: {
                            x: false,
                            y: false
                        }
                    };
                    A._overlay = OverlayFactory.create(B)
                }, after: function () {
                    A.open()
                }, attachListeners: function () {
                    var B = $("game_picker_game_list");
                    if (B) {
                        var D = Games.getToken(A._user.id);
                        var E = B.getElements("button");
                        for (var C in E) {
                            if (!E.hasOwnProperty(C)) {
                                continue
                            }
                            E[C].addEvent("click", function (H) {
                                var F = get_event_target(H).getAttribute("pageKey");
                                var G = get_event_target(H).getAttribute("gameName");
                                Games.challenge_friends.send_challenge(D, F, G, A._user.id);
                                A.close();
                                return false
                            })
                        }
                    }
                }
            };
            this._contentHandler.url = Games._config.game_picker_url.replace(Games._config.challenged_user_placeholder, this._user.id)
        }
        return this._contentHandler
    }, onOpenConversation: function (A) {
        if (this._user.isFromDesktop()) {
            $("dock_item_game_picker_" + this._user.id).show()
        }
    }, onCloseConversation: function (A) {
        this.cancelAllChallenges()
    }, onEnableConversation: function (A) {
        this.enable()
    }, onDisableConversation: function (A) {
        this.disable()
    }
};
Games.challengeStore = {
    challenges: [],
    users: [],
    has: function (A) {
        return typeof this.challenges[A] !== "undefined"
    }, get: function (A) {
        return this.challenges[A]
    }, getAllPending: function () {
        var A = [];
        for (var B in this.challenges) {
            if (!this.challenges.hasOwnProperty(B)) {
                continue
            }
            if (this.challenges[B].isPending) {
                A.push(this.challenges[B])
            }
        }
        return A
    }, getAllByUser: function (B) {
        var A = this.users[B.jid];
        return (typeof A !== "undefined") ? A : []
    }, add: function (B) {
        var A = B.user.jid;
        this.challenges[B.token] = B;
        if (typeof this.users[A] === "undefined") {
            this.users[A] = []
        }
        this.users[A][B.token] = B
    }
};

function GameChallenge(B, C, D, A) {
    this.token = B;
    this.pageKey = C;
    this.gameName = D;
    this.user = A
}
GameChallenge.prototype = {
    token: undefined,
    pageKey: undefined,
    gameName: undefined,
    user: undefined,
    isPending: true,
    accept: function () {
        if (this.isPending) {
            Chat.actions.send_special_message("Game request accepted", this.user.jid, ChatSpecialMessagesMap.GAME_RESPONSE, JSON.encode({
                token: this.token,
                action: "accept"
            }));
            this.isPending = false
        }
    }, ignore: function () {
        if (this.isPending) {
            Chat.actions.send_special_message("Game request cancelled", this.user.jid, ChatSpecialMessagesMap.GAME_RESPONSE, JSON.encode({
                token: this.token,
                action: "cancel"
            }));
            this.isPending = false
        }
    }, cancel: function () {
        if (this.isPending) {
            Chat.actions.send_special_message("Game request cancelled", this.user.jid, ChatSpecialMessagesMap.GAME_RESPONSE, JSON.encode({
                token: this.token,
                action: "cancel",
                "cancellingOwnInvitation": true
            }));
            this.isPending = false
        }
    }, abort: function () {
        if (this.isPending) {
            Chat.actions.send_special_message("Game request ignored", this.user.jid, ChatSpecialMessagesMap.GAME_RESPONSE, JSON.encode({
                token: this.token,
                action: "unavailable"
            }));
            this.isPending = false
        }
    }
};
load.trace("js/web2-Zero/actions/1_games.js", SELECTOR_PRIORITY_TRIGGERS + 3, function () {
    Games.init()
});
load.trace("js/web2-Zero/actions/1_games_triggers.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    CanvasTrigger.extend({
        games_canvas: function () {
            UI.tab("tab_games")
        }, game_canvas: function () {
            UI.tab("tab_games");
            var A = $("safariLauncher");
            if (A !== false) {
                A.submit()
            }
        }
    });
    BlocksTrigger.extend({
        lightbox_game_picker: function () {
            if (OverlayFactory.exists("lightbox_game_picker_overlay")) {
                OverlayFactory.get("lightbox_game_picker_overlay").refresh();
                ChatUIConversationFactory.get_conversation_view(ChatDock.conversation_handler.get_open_conversation()).get_game_picker().getContentHandler().attachListeners()
            }
        }
    })
});
var MultiItemSearch = {
    click: function (B, C, A) {
        this._updateFromServer(B);
        return false
    }, onchange: function (B, C, A) {
        this._updateFromServer(B);
        return false
    }, ageMinSelect: {
        onchange: function (C, E, A) {
            var B = $("age_min");
            var D = $("age_max");
            if (B.selectedIndex > D.selectedIndex && B.selectedIndex !== 0 && D.selectedIndex !== 0) {
                D.selectedIndex = B.selectedIndex
            }
            MultiItemSearch.onchange(C, E, A)
        }
    }, ageMaxSelect: {
        onchange: function (C, B, E) {
            var A = $("age_min");
            var D = $("age_max");
            if (A.selectedIndex > D.selectedIndex && A.selectedIndex !== 0 && D.selectedIndex !== 0) {
                A.selectedIndex = D.selectedIndex
            }
            MultiItemSearch.onchange(C, B, E)
        }
    }, autofills: {
        init: function (B, A, D) {
            var E = $id(B).name;
            var C = new MultiItemSearchFilterAutofillHandler(E);
            var F = new Autofill(B, C, A, D);
            C.initWithAutofill(F)
        }, common_onchange: function (A, B, C) {
            C.value = B;
            MultiItemSearch.onchange(A, [], C)
        }
    }, url: undefined,
    post_params: undefined,
    get_params: undefined,
    _updateFromServer: function (B) {
        var C;
        var A = {};
        var D = $("filterListForm");
        if (D) {
            var E = D.getElementsByTagName("select");
            for (C = 0; C < E.length; C++) {
                var H = $(E[C]);
                if (H.selectedIndex > 0 && H.options[H.selectedIndex].value !== "-") {
                    A[H.name] = H.options[H.selectedIndex].value
                }
            }
            var F = D.getElementsByTagName("input");
            for (C = 0; C < F.length; C++) {
                var G = $(F[C]);
                if (G.value && G.value !== "-") {
                    switch (G.type.toLowerCase()) {
                    case "radio":
                        if (G.checked) {
                            A[G.name] = G.value
                        }
                        break;
                    case "hidden":
                        A[G.name] = G.value;
                        break;
                    default:
                        break
                    }
                }
            }
        }
        var I = $id("searchString").value;
        this.sendSearchRequest(B, I, A)
    }, updateHeaderSearchField: function () {
        if ($id("searchString").value.replace(/^\s+|\s+$/g, "") != "") {
            $id("location_search_text_input").value = $id("searchString").value
        }
    }, sendSearchRequest: function (C, A, B) {
        C += "&string=" + encodeURIComponent(A);
        C += "&filters=" + encodeURIComponent(JSON.encode(B));
        this.url = C;
        Request.AJAX.send(this.url)
    }, before: function (A) {}, after: function (A) {
        if (A.getAttribute("success")) {
            this.updateHeaderSearchField()
        }
    }
};
MultiItemSearch.filters = {
    init_stubs: function () {
        this.generate_age_select($("age_min"));
        this.generate_age_select($("age_max"));
        var E = $("filterForm");
        if (E && (Browser.firefox || Browser.safari)) {
            var F = E.getElementsByTagName("select");
            for (D = 0; D < F.length; D++) {
                var A = $(F[D]);
                A.checked = A.getAttribute("checked")
            }
            var C = E.getElementsByTagName("input");
            var D;
            for (D = 0; D < C.length; D++) {
                var B = C[D];
                if (B.type == "checkbox" && B.checked) {
                    B.checked = B.getAttribute("checked")
                }
            }
        }
    }, generate_age_select: function (B) {
        if (B) {
            var A = parseInt(B.getAttribute("default"));
            var C = document.createDocumentFragment();
            for (var D = 14; D <= 65; D++) {
                var E = document.createElement("option");
                E.value = D;
                E.innerHTML = D;
                if (D == A) {
                    E.selected = true
                }
                C.appendChild(E)
            }
            B.appendChild(C)
        }
    }
};

function MultiItemSearchFilterAutofillHandler(A) {
    this.filterName = A;
    this.autofill = null
}
MultiItemSearchFilterAutofillHandler.prototype = {
    initWithAutofill: function (A) {
        this.autofill = A
    }, item_action: function (C, B, A, F, E, G) {
        var D = $(this.filterName + "AutofillHelper");
        if (!D) {
            D = document.createElement("input");
            D.type = "hidden";
            D.id = this.filterName + "AutofillHelper";
            D.name = this.filterName;
            $("filterListForm").appendChild(D)
        }
        D.value = F;
        MultiItemSearch.autofills.common_onchange(C, B, G)
    }
};
load.trace("js/web2-Zero/actions/1_multiitemsearch.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    CanvasTrigger.extend({
        multiitemsearch: function () {
            UI.tab("tab_people");
            if ($id("filterListForm")) {
                MultiItemSearch.filters.init_stubs()
            }
            if ($id("searchString")) {
                MultiItemSearch.updateHeaderSearchField()
            }
        }
    })
});
load.trace("js_actions_3_zero.js")